From 16d409a1ddc00fdf1af8f6cdfda05abca6c4b49a Mon Sep 17 00:00:00 2001 From: talksik Date: Fri, 10 Jun 2022 06:34:22 -0500 Subject: [PATCH] cleaning up models --- packages/core/models/conversation.model.ts | 42 +++++++++++++++------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/packages/core/models/conversation.model.ts b/packages/core/models/conversation.model.ts index 54b8ced..3050bed 100644 --- a/packages/core/models/conversation.model.ts +++ b/packages/core/models/conversation.model.ts @@ -4,35 +4,51 @@ export default class Conversation { constructor( public createdByUserId: string, - public memberIdsList: string[], + /** + * includes basic user info as well as their information + * for this particular conversation + */ + public members: (ConversationMember & User)[], - public members: ConversationMember[], + public name?: string, - public userCache: User[], - - public name: string | null = null, + /** + * last time there was new content for everyone + */ + public lastActivityDate = new Date(), + /** + * when name was changed or member list updated + */ public lastUpdatedDate = new Date(), - public createdDate = new Date(), - public membersInRoom: string[] = [], - public id?: string, ) {} } export class ConversationMember { constructor( - public userId: string, // NOTE: serves as the user ID - public role: MemberRole, public memberState: MemberState, public joinedDate = new Date(), - public lastActiveDate?: Date, // when I last spoke in the conversation or contributed with some content - public lastVisitDate?: Date, // when I last clicked into a conversation - public lastFetchDate?: Date, // for the use of long polling in the future + + /** + * when I last spoke in the conversation or contributed to a conversation + */ + public lastActiveDate?: Date, + + /** + * last time I clicked into a conversation + */ + public lastVisitDate?: Date, + + /** + * when this conversation was last brought to my attention/displayed + * for the use of long polling in the future + */ + public lastFetchDate?: Date, ) {} }