tasq/lib/models/announcement_comment.dart

48 lines
1.2 KiB
Dart

import '../utils/app_time.dart';
class AnnouncementComment {
AnnouncementComment({
required this.id,
required this.announcementId,
required this.authorId,
required this.body,
required this.createdAt,
});
final String id;
final String announcementId;
final String authorId;
final String body;
final DateTime createdAt;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is AnnouncementComment &&
runtimeType == other.runtimeType &&
id == other.id &&
announcementId == other.announcementId &&
authorId == other.authorId &&
body == other.body &&
createdAt == other.createdAt;
@override
int get hashCode => Object.hash(
id,
announcementId,
authorId,
body,
createdAt,
);
factory AnnouncementComment.fromMap(Map<String, dynamic> map) {
return AnnouncementComment(
id: map['id'] as String,
announcementId: map['announcement_id'] as String,
authorId: map['author_id'] as String,
body: map['body'] as String? ?? '',
createdAt: AppTime.parse(map['created_at'] as String),
);
}
}