cleaning up models

This commit is contained in:
talksik
2022-06-10 06:34:22 -05:00
parent 68299668a7
commit 16d409a1dd
+29 -13
View File
@@ -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,
) {}
}