adding models and stale state for convos
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import { ObjectId } from "mongodb";
|
||||
|
||||
export default class AudioClip {
|
||||
constructor(
|
||||
public _id: ObjectId,
|
||||
|
||||
public url: string,
|
||||
|
||||
public createdDate: Date = new Date(),
|
||||
public duration?: number
|
||||
) {}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import { ObjectId } from "mongodb";
|
||||
|
||||
export class Conversation {
|
||||
_id: ObjectId;
|
||||
name?: string;
|
||||
|
||||
createdDate: Date;
|
||||
lastUpdatedDate: Date;
|
||||
|
||||
constructor() {}
|
||||
}
|
||||
|
||||
export class ConversationMember {
|
||||
_id: ObjectId;
|
||||
|
||||
// unique constraint
|
||||
conversationId: ObjectId;
|
||||
userId: ObjectId;
|
||||
|
||||
state: ConversationMemberState;
|
||||
|
||||
createdDate: Date;
|
||||
}
|
||||
|
||||
export enum ConversationMemberState {
|
||||
INVITED = "INVITED", // user gets this in their request inbox
|
||||
INBOX = "INBOX", // user decided to join this conversation after being invited
|
||||
TUNED = "TUNED", // user upgraded priority of this and now is tuned in live to convo
|
||||
ARCHIVED = "ARCHIVED", // user no longer wants anything to do with convo
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import AudioClip from "./audioClip.model";
|
||||
import { ConversationMember } from "./conversation.model";
|
||||
import { ObjectId } from "mongodb";
|
||||
|
||||
export default class MasterConversation {
|
||||
// attributes of conversation
|
||||
id: ObjectId; // id of the conversation
|
||||
name?: string;
|
||||
createdDate: Date;
|
||||
lastUpdatedDate: Date;
|
||||
|
||||
// compiled data for easy client read
|
||||
currentUserMember: ConversationMember;
|
||||
otherMembers: ConversationMember[];
|
||||
|
||||
audioClips: AudioClip[];
|
||||
}
|
||||
Reference in New Issue
Block a user