refactor(persistence): Align message entity with StreamChat.
Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
@@ -53,14 +53,52 @@ class Messages extends Table {
|
||||
/// A used command name.
|
||||
TextColumn get command => text().nullable()();
|
||||
|
||||
/// The DateTime when the message was created.
|
||||
DateTimeColumn get createdAt => dateTime().withDefault(currentDateAndTime)();
|
||||
/// The DateTime on which the message was created.
|
||||
///
|
||||
/// Returns the latest between [localCreatedAt] and [remoteCreatedAt].
|
||||
/// If both are null, returns [currentDateAndTime].
|
||||
Expression<DateTime> get createdAt {
|
||||
return coalesce<DateTime>(
|
||||
[localCreatedAt, remoteCreatedAt, currentDateAndTime],
|
||||
);
|
||||
}
|
||||
|
||||
/// The DateTime when the message was updated last time.
|
||||
DateTimeColumn get updatedAt => dateTime().withDefault(currentDateAndTime)();
|
||||
/// The DateTime on which the message was created on the client.
|
||||
DateTimeColumn get localCreatedAt => dateTime().nullable()();
|
||||
|
||||
/// The DateTime when the message was deleted.
|
||||
DateTimeColumn get deletedAt => dateTime().nullable()();
|
||||
/// The DateTime on which the message was created on the server.
|
||||
DateTimeColumn get remoteCreatedAt => dateTime().nullable()();
|
||||
|
||||
/// The DateTime on which the message was updated last time.
|
||||
///
|
||||
/// Returns the latest between [localUpdatedAt] and [remoteUpdatedAt].
|
||||
/// If both are null, returns [createdAt].
|
||||
Expression<DateTime> get updatedAt {
|
||||
return coalesce<DateTime>(
|
||||
[localUpdatedAt, remoteUpdatedAt, createdAt],
|
||||
);
|
||||
}
|
||||
|
||||
/// The DateTime on which the message was updated on the client.
|
||||
DateTimeColumn get localUpdatedAt => dateTime().nullable()();
|
||||
|
||||
/// The DateTime on which the message was updated on the server.
|
||||
DateTimeColumn get remoteUpdatedAt => dateTime().nullable()();
|
||||
|
||||
/// The DateTime on which the message was deleted.
|
||||
///
|
||||
/// Returns the latest between [localDeletedAt] and [remoteDeletedAt].
|
||||
Expression<DateTime> get deletedAt {
|
||||
return coalesce<DateTime>(
|
||||
[localDeletedAt, remoteDeletedAt],
|
||||
);
|
||||
}
|
||||
|
||||
/// The DateTime on which the message was deleted on the client.
|
||||
DateTimeColumn get localDeletedAt => dateTime().nullable()();
|
||||
|
||||
/// The DateTime on which the message was deleted on the server.
|
||||
DateTimeColumn get remoteDeletedAt => dateTime().nullable()();
|
||||
|
||||
/// Id of the User who sent the message
|
||||
TextColumn get userId => text().nullable()();
|
||||
|
||||
Reference in New Issue
Block a user