add auth, format
This commit is contained in:
@@ -7,18 +7,39 @@ part 'chat_room_model.g.dart';
|
||||
|
||||
@HiveType(typeId: HiveTypeIds.chatRoomModel)
|
||||
class ChatRoomModel extends HiveObject {
|
||||
ChatRoomModel({required this.chatRoomId, required this.roomType, this.relatedQuoteId, this.relatedOrderId, required this.participants, this.roomName, required this.isActive, this.lastActivity, required this.createdAt, this.createdBy});
|
||||
|
||||
@HiveField(0) final String chatRoomId;
|
||||
@HiveField(1) final RoomType roomType;
|
||||
@HiveField(2) final String? relatedQuoteId;
|
||||
@HiveField(3) final String? relatedOrderId;
|
||||
@HiveField(4) final String participants;
|
||||
@HiveField(5) final String? roomName;
|
||||
@HiveField(6) final bool isActive;
|
||||
@HiveField(7) final DateTime? lastActivity;
|
||||
@HiveField(8) final DateTime createdAt;
|
||||
@HiveField(9) final String? createdBy;
|
||||
ChatRoomModel({
|
||||
required this.chatRoomId,
|
||||
required this.roomType,
|
||||
this.relatedQuoteId,
|
||||
this.relatedOrderId,
|
||||
required this.participants,
|
||||
this.roomName,
|
||||
required this.isActive,
|
||||
this.lastActivity,
|
||||
required this.createdAt,
|
||||
this.createdBy,
|
||||
});
|
||||
|
||||
@HiveField(0)
|
||||
final String chatRoomId;
|
||||
@HiveField(1)
|
||||
final RoomType roomType;
|
||||
@HiveField(2)
|
||||
final String? relatedQuoteId;
|
||||
@HiveField(3)
|
||||
final String? relatedOrderId;
|
||||
@HiveField(4)
|
||||
final String participants;
|
||||
@HiveField(5)
|
||||
final String? roomName;
|
||||
@HiveField(6)
|
||||
final bool isActive;
|
||||
@HiveField(7)
|
||||
final DateTime? lastActivity;
|
||||
@HiveField(8)
|
||||
final DateTime createdAt;
|
||||
@HiveField(9)
|
||||
final String? createdBy;
|
||||
|
||||
factory ChatRoomModel.fromJson(Map<String, dynamic> json) => ChatRoomModel(
|
||||
chatRoomId: json['chat_room_id'] as String,
|
||||
@@ -28,7 +49,9 @@ class ChatRoomModel extends HiveObject {
|
||||
participants: jsonEncode(json['participants']),
|
||||
roomName: json['room_name'] as String?,
|
||||
isActive: json['is_active'] as bool? ?? true,
|
||||
lastActivity: json['last_activity'] != null ? DateTime.parse(json['last_activity']?.toString() ?? '') : null,
|
||||
lastActivity: json['last_activity'] != null
|
||||
? DateTime.parse(json['last_activity']?.toString() ?? '')
|
||||
: null,
|
||||
createdAt: DateTime.parse(json['created_at']?.toString() ?? ''),
|
||||
createdBy: json['created_by'] as String?,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user