From b7dea99d4e402d2dd137000605962a72a8c2d743 Mon Sep 17 00:00:00 2001 From: talksik Date: Sat, 28 May 2022 14:12:35 -0500 Subject: [PATCH] creating rough models to make everythigg work --- packages/core/src/models/content.model.ts | 40 +++++++++++++++++++ .../core/src/models/conversation.model.ts | 22 ++++++++++ 2 files changed, 62 insertions(+) create mode 100644 packages/core/src/models/content.model.ts create mode 100644 packages/core/src/models/conversation.model.ts diff --git a/packages/core/src/models/content.model.ts b/packages/core/src/models/content.model.ts new file mode 100644 index 0000000..9cb156e --- /dev/null +++ b/packages/core/src/models/content.model.ts @@ -0,0 +1,40 @@ +import { Timestamp } from 'firebase/firestore'; + +interface IContent { + id: string; + creatorUserId: string; + contentUrl: string; // remote resource of file/media + createdDate: Timestamp; + + // visitCount +} + +// ? persist length of clip for easier viewing for others... +// ?they have to load it anyway and will get metadata anyway? +export class AudioClip implements IContent { + constructor( + public id: string, + public creatorUserId: string, + public contentUrl: string, + public createdDate: Timestamp = Timestamp.now(), + ) {} +} + +export class Link implements IContent { + constructor( + public id: string, + public creatorUserId: string, + public contentUrl: string, + public createdDate: Timestamp = Timestamp.now(), + ) {} +} + +export class Image implements IContent { + constructor( + public id: string, + public creatorUserId: string, + public contentUrl: string, + public thumbnailUrl?: string, + public createdDate: Timestamp = Timestamp.now(), + ) {} +} diff --git a/packages/core/src/models/conversation.model.ts b/packages/core/src/models/conversation.model.ts new file mode 100644 index 0000000..cc7004f --- /dev/null +++ b/packages/core/src/models/conversation.model.ts @@ -0,0 +1,22 @@ +import { FieldValue, serverTimestamp, Timestamp } from 'firebase/firestore'; +export default class Conversation { + constructor( + public id: string, + public name: string, + + public createdByUserId: string, + + public lastUpdatedDate, + + public createdDate, + ) {} +} + +export class Member { + constructor( + public id: string, + public userId: string, + public role: 'admin' | 'regular', + public joinedDate = serverTimestamp(), + ) {} +}