Initial commit
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
class Task {
|
||||
Task({
|
||||
required this.id,
|
||||
required this.ticketId,
|
||||
required this.title,
|
||||
required this.description,
|
||||
required this.officeId,
|
||||
required this.status,
|
||||
required this.priority,
|
||||
required this.queueOrder,
|
||||
required this.createdAt,
|
||||
required this.creatorId,
|
||||
required this.startedAt,
|
||||
required this.completedAt,
|
||||
});
|
||||
|
||||
final String id;
|
||||
final String? ticketId;
|
||||
final String title;
|
||||
final String description;
|
||||
final String? officeId;
|
||||
final String status;
|
||||
final int priority;
|
||||
final int? queueOrder;
|
||||
final DateTime createdAt;
|
||||
final String? creatorId;
|
||||
final DateTime? startedAt;
|
||||
final DateTime? completedAt;
|
||||
|
||||
factory Task.fromMap(Map<String, dynamic> map) {
|
||||
return Task(
|
||||
id: map['id'] as String,
|
||||
ticketId: map['ticket_id'] as String?,
|
||||
title: map['title'] as String? ?? 'Task',
|
||||
description: map['description'] as String? ?? '',
|
||||
officeId: map['office_id'] as String?,
|
||||
status: map['status'] as String? ?? 'queued',
|
||||
priority: map['priority'] as int? ?? 1,
|
||||
queueOrder: map['queue_order'] as int?,
|
||||
createdAt: DateTime.parse(map['created_at'] as String),
|
||||
creatorId: map['creator_id'] as String?,
|
||||
startedAt: map['started_at'] == null
|
||||
? null
|
||||
: DateTime.parse(map['started_at'] as String),
|
||||
completedAt: map['completed_at'] == null
|
||||
? null
|
||||
: DateTime.parse(map['completed_at'] as String),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user