[LLC, Persistence] Add doc comments

Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
Sahil Kumar
2021-01-28 19:48:54 +05:30
parent 6e5894eebe
commit 86a122aa23
30 changed files with 154 additions and 68 deletions
@@ -1,9 +1,12 @@
import 'package:moor/moor.dart';
/// Represents a [ChannelQueries] table in [MoorChatDatabase].
@DataClassName('ChannelQueryEntity')
class ChannelQueries extends Table {
/// The unique hash of this query
TextColumn get queryHash => text()();
/// The channel cid of this query
TextColumn get channelCid => text()();
@override
@@ -1,30 +1,43 @@
import 'package:moor/moor.dart';
import 'package:stream_chat_persistence/src/converter/map_converter.dart';
/// Represents a [Channels] table in [MoorChatDatabase].
@DataClassName('ChannelEntity')
class Channels extends Table {
/// The id of this channel
TextColumn get id => text()();
/// The type of this channel
TextColumn get type => text()();
/// The cid of this channel
TextColumn get cid => text()();
/// The channel configuration data
TextColumn get config => text().map(MapConverter<Object>())();
/// True if this channel entity is frozen
BoolColumn get frozen => boolean().withDefault(Constant(false))();
/// The date of the last message
DateTimeColumn get lastMessageAt => dateTime().nullable()();
/// The date of channel creation
DateTimeColumn get createdAt => dateTime().nullable()();
/// The date of the last channel update
DateTimeColumn get updatedAt => dateTime().nullable()();
/// The date of channel deletion
DateTimeColumn get deletedAt => dateTime().nullable()();
/// The count of this channel members
IntColumn get memberCount => integer().nullable()();
/// The id of the user that created this channel
TextColumn get createdById => text().nullable()();
/// Map of custom channel extraData
TextColumn get extraData => text().nullable().map(MapConverter<Object>())();
@override
@@ -1,18 +1,25 @@
import 'package:moor/moor.dart';
import 'package:stream_chat_persistence/src/converter/map_converter.dart';
/// Represents a [ConnectionEvents] table in [MoorChatDatabase].
@DataClassName('ConnectionEventEntity')
class ConnectionEvents extends Table {
/// event id
IntColumn get id => integer()();
/// User object of the current user
TextColumn get ownUser => text().nullable().map(MapConverter<Object>())();
/// The number of unread messages for current user
IntColumn get totalUnreadCount => integer().nullable()();
/// User total unread channels for current user
IntColumn get unreadChannels => integer().nullable()();
/// DateTime of the last event
DateTimeColumn get lastEventAt => dateTime().nullable()();
/// DateTime of the last sync
DateTimeColumn get lastSyncAt => dateTime().nullable()();
@override
@@ -1,28 +1,40 @@
import 'package:moor/moor.dart';
/// Represents a [Members] table in [MoorChatDatabase].
@DataClassName('MemberEntity')
class Members extends Table {
/// The interested user id
TextColumn get userId => text()();
/// The channel cid of which this user is part of
TextColumn get channelCid =>
text().customConstraint('REFERENCES channels(cid) ON DELETE CASCADE')();
/// The role of the user in the channel
TextColumn get role => text().nullable()();
/// The date on which the user accepted the invite to the channel
DateTimeColumn get inviteAcceptedAt => dateTime().nullable()();
/// The date on which the user rejected the invite to the channel
DateTimeColumn get inviteRejectedAt => dateTime().nullable()();
/// True if the user has been invited to the channel
BoolColumn get invited => boolean().nullable()();
/// True if the member is banned from the channel
BoolColumn get banned => boolean().nullable()();
/// True if the member is shadow banned from the channel
BoolColumn get shadowBanned => boolean().nullable()();
/// True if the user is a moderator of the channel
BoolColumn get isModerator => boolean().nullable()();
/// The date of creation
DateTimeColumn get createdAt => dateTime()();
/// The last date of update
DateTimeColumn get updatedAt => dateTime().nullable()();
@override
@@ -3,50 +3,72 @@ import 'package:stream_chat_persistence/src/converter/list_converter.dart';
import 'package:stream_chat_persistence/src/converter/map_converter.dart';
import 'package:stream_chat_persistence/src/converter/message_sending_status_converter.dart';
/// Represents a [Messages] table in [MoorChatDatabase].
@DataClassName('MessageEntity')
class Messages extends Table {
/// The message id
TextColumn get id => text()();
/// The text of this message
TextColumn get messageText => text().nullable()();
/// The list of attachments, either provided by the user
/// or generated from a command or as a result of URL scraping.
TextColumn get attachments =>
text().nullable().map(ListConverter<String>())();
/// The status of a sending message
IntColumn get status =>
integer().nullable().map(MessageSendingStatusConverter())();
/// The message type
TextColumn get type => text().nullable()();
/// The list of user mentioned in the message
TextColumn get mentionedUsers =>
text().nullable().map(ListConverter<String>())();
/// A map describing the count of number of every reaction
TextColumn get reactionCounts => text().nullable().map(MapConverter<int>())();
/// A map describing the count of score of every reaction
TextColumn get reactionScores => text().nullable().map(MapConverter<int>())();
/// The ID of the parent message, if the message is a thread reply.
TextColumn get parentId => text().nullable()();
/// The ID of the quoted message, if the message is a quoted reply.
TextColumn get quotedMessageId => text().nullable()();
/// Number of replies for this message.
IntColumn get replyCount => integer().nullable()();
/// Check if this message needs to show in the channel.
BoolColumn get showInChannel => boolean().nullable()();
/// If true the message is shadowed
BoolColumn get shadowed => boolean().nullable()();
/// A used command name.
TextColumn get command => text().nullable()();
/// The DateTime when the message was created.
DateTimeColumn get createdAt => dateTime()();
/// The DateTime when the message was updated last time.
DateTimeColumn get updatedAt => dateTime().nullable()();
/// The DateTime when the message was deleted.
DateTimeColumn get deletedAt => dateTime().nullable()();
/// Id of the User who sent the message
TextColumn get userId => text().nullable()();
/// The channel cid of which this message is part of
TextColumn get channelCid => text().nullable().customConstraint(
'NULLABLE REFERENCES channels(cid) ON DELETE CASCADE')();
/// Message custom extraData
TextColumn get extraData => text().nullable().map(MapConverter<Object>())();
@override
@@ -1,19 +1,26 @@
import 'package:moor/moor.dart';
import 'package:stream_chat_persistence/src/converter/map_converter.dart';
/// Represents a [Reactions] table in [MoorChatDatabase].
@DataClassName('ReactionEntity')
class Reactions extends Table {
/// The id of the user that sent the reaction
TextColumn get userId => text()();
/// The messageId to which the reaction belongs
TextColumn get messageId =>
text().customConstraint('REFERENCES messages(id) ON DELETE CASCADE')();
/// The type of the reaction
TextColumn get type => text()();
/// The DateTime on which the reaction is created
DateTimeColumn get createdAt => dateTime()();
/// The score of the reaction (ie. number of reactions sent)
IntColumn get score => integer().nullable()();
/// Reaction custom extraData
TextColumn get extraData => text().nullable().map(MapConverter<Object>())();
@override
@@ -1,14 +1,19 @@
import 'package:moor/moor.dart';
/// Represents a [Reads] table in [MoorChatDatabase].
@DataClassName('ReadEntity')
class Reads extends Table {
/// Date of the read event
DateTimeColumn get lastRead => dateTime()();
/// Id of the User who sent the event
TextColumn get userId => text()();
/// The channel cid of which this read belongs
TextColumn get channelCid =>
text().customConstraint('REFERENCES channels(cid) ON DELETE CASCADE')();
/// Number of unread messages
IntColumn get unreadMessages => integer().nullable()();
@override
@@ -1,22 +1,31 @@
import 'package:moor/moor.dart';
import 'package:stream_chat_persistence/src/converter/map_converter.dart';
/// Represents a [Users] table in [MoorChatDatabase].
@DataClassName('UserEntity')
class Users extends Table {
/// User id
TextColumn get id => text()();
/// User role
TextColumn get role => text().nullable()();
/// Date of user creation
DateTimeColumn get createdAt => dateTime().nullable()();
/// Date of last user update
DateTimeColumn get updatedAt => dateTime().nullable()();
/// Date of last user connection
DateTimeColumn get lastActive => dateTime().nullable()();
/// True if user is online
BoolColumn get online => boolean().nullable()();
/// True if user is banned from the chat
BoolColumn get banned => boolean().nullable()();
/// Map of custom user extraData
TextColumn get extraData => text().nullable().map(MapConverter<Object>())();
@override