throwing away bunch of garbage

This commit is contained in:
talksik
2022-06-10 05:29:30 -05:00
parent 7af1c1ceb0
commit 445d1ef522
32 changed files with 120 additions and 2471 deletions
+29 -10
View File
@@ -1,19 +1,38 @@
import { ObjectId } from "mongodb";
import { ObjectId } from 'mongodb';
export default class Content {
export interface IContent {
id?: string;
creatorUserId: string;
contentUrl: string; // remote resource of file/media
createdDate: Date;
// visitCount
}
// ? persist length of clip for easier viewing for others...
// ?they have to load it anyway and will get metadata anyway?
export class ContentBlock implements IContent {
constructor(
public relationshipId: string, // if it's a one on one, this will be the relationship Id
public sentDate: Date,
public creatorUserId: string,
public contentUrl: string,
public contentData: string,
public contentType: ContentType,
public _id?: ObjectId,
public listenedDate?: Date
public blobType: string,
public createdDate = new Date(),
public id?: string,
) {}
}
export enum ContentType {
link = "LINK",
audioClip = "AUDIO_CLIP",
text = "TEXT",
audio = 'audio',
link = 'link',
image = 'image',
code = 'code',
}
export function isUrlImage(url: string) {
return url.match(/\.(jpeg|jpg|gif|png)$/) != null;
}
@@ -0,0 +1,47 @@
import User from './user.model';
export default class Conversation {
constructor(
public createdByUserId: string,
public memberIdsList: string[],
public members: ConversationMember[],
public userCache: User[],
public name: string | null = null,
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
) {}
}
export enum MemberRole {
admin = 'admin',
regular = 'regular',
}
export enum MemberState {
priority = 'priority',
inbox = 'inbox',
// deleted = "deleted"
}
@@ -1,14 +0,0 @@
import { ObjectId } from "mongodb";
export class GoogleUserInfo {
constructor(
public id: string,
public email: string,
public verifiedEmail: boolean,
public name: string,
public given_name: string,
public family_name: string,
public picture: string,
public locale: string
) {}
}
-2
View File
@@ -1,2 +0,0 @@
export * from "./googleUserInfo.model";
export * from "./user.model";
-38
View File
@@ -1,38 +0,0 @@
import { ObjectId } from "mongodb";
export class Line {
constructor(
public createdByUserId: ObjectId,
public name?: string,
public createdDate: Date = new Date(),
public lastUpdatedDate: Date = new Date(),
public _id?: ObjectId
) {}
}
export class LineMember {
// the last time that the user visited the line
// for new activity monitoring
lastVisitDate?: Date;
constructor(
// unique constraint
public lineId: ObjectId,
public userId: ObjectId,
public state: LineMemberState,
public createdDate: Date = new Date(),
public _id?: ObjectId
) {}
}
export enum LineMemberState {
// these states will be for later when we want an inbox and such
// INVITED = "INVITED", // user gets this in their request inbox
// ARCHIVED = "ARCHIVED", // user no longer wants anything to do with convo
INBOX = "INBOX", // user decided to join this conversation after being invited...for now things just land in inbox anyway
TUNED = "TUNED", // user upgraded priority of this and now is toggle tuned in live to convo
}
@@ -1,51 +0,0 @@
import { Line, LineMember } from './line.model';
import AudioClip from './audioClip.model';
import { ObjectId } from 'mongodb';
import { User } from './user.model';
// why do we have separate full objects being sent?
// speed...I'm developing full stack and I just want all of the data and don't want to change this model
// repeatedly and trace data back and forth
export default class MasterLineData {
// NOTE: these properties should be kept optional cuzz default values won't show up for
// all clients who are casting response objects
// not really necessary, but clients can know all connected folks
// -> if they wanted to get the feeling of people being right there
connectedMemberIds?: string[];
// all of the current session tuned in folks for user to see
// -> use as source of truth whether or not I am tuned in or not for UI to avoid confusion
// ->
tunedInMemberIds?: string[];
// list of user Ids of everyone who is buzzing in this line
// -> all connected line members be able to show this in the right activity section of the lineRow
currentBroadcastersUserIds?: string[];
profilePictures?: {
allMembers: string[];
allMembersWithoutMe: string[];
untunedMembers: string[];
tunedMembers: string[];
broadcastMembers: string[];
} = undefined;
isUserTunedIn: boolean = false;
isUserToggleTuned: boolean = false;
constructor(
// full line object
public lineDetails: Line,
// requesting user's association to the line
public currentUserMember: LineMember,
// all other members in the convo as well as their user object to see the member details
public otherMembers?: LineMember[],
public otherUserObjects?: User[] /**public audioClips: AudioClip[] = [], // public media: Media[] */,
) {}
}
@@ -1,22 +0,0 @@
import { ObjectId } from "mongodb";
// some sort of contact or friend model
export default class Relationship {
constructor(
public senderUserId: string, // sender as the one to initiate the relationship
public receiverUserId: string,
public state: RelationshipState,
public createdDate: Date = new Date(),
public lastUpdatedDate: Date = new Date(),
public _id?: ObjectId
) {}
}
export enum RelationshipState {
PENDING = "PENDING",
ACTIVE = "ACTIVE",
BLOCKED = "BLOCKED",
DENIED = "DENIED",
}
+20 -7
View File
@@ -1,8 +1,8 @@
import { ObjectId } from "mongodb";
import { ObjectId } from 'mongodb';
export class User {
export default class User {
constructor(
public googleId: string, // our Google id that every google user has unique that we are going to use for now
public googleId: string,
public email: string,
public name: string,
@@ -17,12 +17,25 @@ export class User {
// additional properties specific to our users collection
public status?: UserStatus,
public lastUpdatedDate?: Date,
public _id?: ObjectId
public _id?: ObjectId,
) {}
}
export enum UserStatus {
ONLINE = "ONLINE",
OFFLINE = "OFFLINE",
FLOW_STATE = "FLOW_STATE",
ONLINE = 'ONLINE',
OFFLINE = 'OFFLINE',
FLOW_STATE = 'FLOW_STATE',
}
export class GoogleUserInfo {
constructor(
public id: string,
public email: string,
public verifiedEmail: boolean,
public name: string,
public given_name: string,
public family_name: string,
public picture: string,
public locale: string,
) {}
}