Initial commit
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
class NotificationItem {
|
||||
NotificationItem({
|
||||
required this.id,
|
||||
required this.userId,
|
||||
required this.actorId,
|
||||
required this.ticketId,
|
||||
required this.taskId,
|
||||
required this.messageId,
|
||||
required this.type,
|
||||
required this.createdAt,
|
||||
required this.readAt,
|
||||
});
|
||||
|
||||
final String id;
|
||||
final String userId;
|
||||
final String? actorId;
|
||||
final String? ticketId;
|
||||
final String? taskId;
|
||||
final int? messageId;
|
||||
final String type;
|
||||
final DateTime createdAt;
|
||||
final DateTime? readAt;
|
||||
|
||||
bool get isUnread => readAt == null;
|
||||
|
||||
factory NotificationItem.fromMap(Map<String, dynamic> map) {
|
||||
return NotificationItem(
|
||||
id: map['id'] as String,
|
||||
userId: map['user_id'] as String,
|
||||
actorId: map['actor_id'] as String?,
|
||||
ticketId: map['ticket_id'] as String?,
|
||||
taskId: map['task_id'] as String?,
|
||||
messageId: map['message_id'] as int?,
|
||||
type: map['type'] as String? ?? 'mention',
|
||||
createdAt: DateTime.parse(map['created_at'] as String),
|
||||
readAt: map['read_at'] == null
|
||||
? null
|
||||
: DateTime.parse(map['read_at'] as String),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class Office {
|
||||
Office({required this.id, required this.name});
|
||||
|
||||
final String id;
|
||||
final String name;
|
||||
|
||||
factory Office.fromMap(Map<String, dynamic> map) {
|
||||
return Office(id: map['id'] as String, name: map['name'] as String? ?? '');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
class Profile {
|
||||
Profile({required this.id, required this.role, required this.fullName});
|
||||
|
||||
final String id;
|
||||
final String role;
|
||||
final String fullName;
|
||||
|
||||
factory Profile.fromMap(Map<String, dynamic> map) {
|
||||
return Profile(
|
||||
id: map['id'] as String,
|
||||
role: map['role'] as String? ?? 'standard',
|
||||
fullName: map['full_name'] as String? ?? '',
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
class TaskAssignment {
|
||||
TaskAssignment({
|
||||
required this.taskId,
|
||||
required this.userId,
|
||||
required this.createdAt,
|
||||
});
|
||||
|
||||
final String taskId;
|
||||
final String userId;
|
||||
final DateTime createdAt;
|
||||
|
||||
factory TaskAssignment.fromMap(Map<String, dynamic> map) {
|
||||
return TaskAssignment(
|
||||
taskId: map['task_id'] as String,
|
||||
userId: map['user_id'] as String,
|
||||
createdAt: DateTime.parse(map['created_at'] as String),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
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: DateTime.parse(map['created_at'] as String),
|
||||
creatorId: map['creator_id'] as String?,
|
||||
respondedAt: map['responded_at'] == null
|
||||
? null
|
||||
: DateTime.parse(map['responded_at'] as String),
|
||||
promotedAt: map['promoted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(map['promoted_at'] as String),
|
||||
closedAt: map['closed_at'] == null
|
||||
? null
|
||||
: DateTime.parse(map['closed_at'] as String),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
class TicketMessage {
|
||||
TicketMessage({
|
||||
required this.id,
|
||||
required this.ticketId,
|
||||
required this.taskId,
|
||||
required this.senderId,
|
||||
required this.content,
|
||||
required this.createdAt,
|
||||
});
|
||||
|
||||
final int id;
|
||||
final String? ticketId;
|
||||
final String? taskId;
|
||||
final String? senderId;
|
||||
final String content;
|
||||
final DateTime createdAt;
|
||||
|
||||
factory TicketMessage.fromMap(Map<String, dynamic> map) {
|
||||
return TicketMessage(
|
||||
id: map['id'] as int,
|
||||
ticketId: map['ticket_id'] as String?,
|
||||
taskId: map['task_id'] as String?,
|
||||
senderId: map['sender_id'] as String?,
|
||||
content: map['content'] as String? ?? '',
|
||||
createdAt: DateTime.parse(map['created_at'] as String),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
class UserOffice {
|
||||
UserOffice({required this.userId, required this.officeId});
|
||||
|
||||
final String userId;
|
||||
final String officeId;
|
||||
|
||||
factory UserOffice.fromMap(Map<String, dynamic> map) {
|
||||
return UserOffice(
|
||||
userId: map['user_id'] as String,
|
||||
officeId: map['office_id'] as String,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user