49 lines
1.4 KiB
Dart
49 lines
1.4 KiB
Dart
import '../utils/app_time.dart';
|
|
|
|
class Ticket {
|
|
Ticket({
|
|
required this.id,
|
|
required this.subject,
|
|
required this.description,
|
|
required this.officeId,
|
|
required this.status,
|
|
required this.createdAt,
|
|
required this.creatorId,
|
|
required this.respondedAt,
|
|
required this.promotedAt,
|
|
required this.closedAt,
|
|
});
|
|
|
|
final String id;
|
|
final String subject;
|
|
final String description;
|
|
final String officeId;
|
|
final String status;
|
|
final DateTime createdAt;
|
|
final String? creatorId;
|
|
final DateTime? respondedAt;
|
|
final DateTime? promotedAt;
|
|
final DateTime? closedAt;
|
|
|
|
factory Ticket.fromMap(Map<String, dynamic> map) {
|
|
return Ticket(
|
|
id: map['id'] as String,
|
|
subject: map['subject'] as String? ?? '',
|
|
description: map['description'] as String? ?? '',
|
|
officeId: map['office_id'] as String? ?? '',
|
|
status: map['status'] as String? ?? 'pending',
|
|
createdAt: AppTime.parse(map['created_at'] as String),
|
|
creatorId: map['creator_id'] as String?,
|
|
respondedAt: map['responded_at'] == null
|
|
? null
|
|
: AppTime.parse(map['responded_at'] as String),
|
|
promotedAt: map['promoted_at'] == null
|
|
? null
|
|
: AppTime.parse(map['promoted_at'] as String),
|
|
closedAt: map['closed_at'] == null
|
|
? null
|
|
: AppTime.parse(map['closed_at'] as String),
|
|
);
|
|
}
|
|
}
|