having one solution for different components of app

This commit is contained in:
Arjun Patel
2022-01-27 20:17:00 -08:00
parent 0d23d1dfd7
commit 0f7e5a831b
256 changed files with 7997 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
import { Timestamp } from "firebase/firestore";
export default class Announcement {
id: string;
teamId: string;
audioDataUrl: string; // link to cloud storage file
state: AnnouncementState = AnnouncementState.active;
createdByUserId: string;
createdDate: Timestamp;
lastUpdatedDate: Timestamp;
constructor(_audioUrl: string, _teamId: string, _createdByUserId: string) {
this.audioDataUrl = _audioUrl;
this.createdByUserId = _createdByUserId;
this.teamId = _teamId;
}
}
export enum AnnouncementState {
active = "active",
resolved = "resolved",
deleted = "deleted",
}
+7
View File
@@ -0,0 +1,7 @@
export default interface IFirestoreSerializable {
id: string;
serialize: () => {};
// deserialize: (firestoreData: {}) => {};
}
+87
View File
@@ -0,0 +1,87 @@
import { Timestamp } from "firebase/firestore";
export default class Link {
id: string;
name: string;
description: string;
link: string; //url for file
state: LinkState = LinkState.active;
type: LinkType;
teamId: string;
// if it's not a teamAttachment, then have a list of members who it's for
recipients: string[]; // userIds
createdByUserId: string;
createdDate: Timestamp;
constructor(
_name: string,
_description: string,
_link: string,
_teamId: string,
recipientsArr: string[],
_createdByUserId: string
) {
this.name = _name;
this.description = _description;
this.link = _link;
this.teamId = _teamId;
this.recipients = recipientsArr;
this.createdByUserId = _createdByUserId;
if (!recipientsArr || recipientsArr?.length == 0) {
this.recipients = null;
} else {
this.recipients = recipientsArr;
}
this.type = Link.getLinkType(_link);
}
static getLinkType(url: string): LinkType {
if (url.includes(LinkType.github)) {
return LinkType.github;
} else if (url.includes(LinkType.atlassian)) {
return LinkType.atlassian;
} else if (
url.includes(LinkType.googleDrive) ||
url.includes("docs.google")
) {
return LinkType.googleDrive;
} else if (
url.includes(".png") ||
url.includes(".jpg") ||
url.includes(".svg") ||
url.includes(".gif") ||
url.includes(LinkType.pastePics)
) {
return LinkType.image;
} else if (url.includes(LinkType.pdf)) {
return LinkType.pdf;
} else if (url.includes(LinkType.codePile)) {
return LinkType.codePile;
} else {
return LinkType.default;
}
}
}
export enum LinkState {
active = "active",
archived = "archived",
deleted = "deleted",
}
export enum LinkType {
default = "default",
github = "github",
atlassian = "atlassian",
googleDrive = "drive.google",
onedrive = "onedrive",
image = "image",
pdf = "pdf",
codePile = "codepile",
pastePics = "paste.pics",
}
+15
View File
@@ -0,0 +1,15 @@
import { Timestamp } from "firebase/firestore";
export class Message {
id: string;
audioDataUrl: string;
senderUserId: string;
receiverUserId: string;
senderReceiver: string[]; // composite to make querying easier in the future
createdDate: Timestamp;
// firstListenDate: Timestamp;
}
+37
View File
@@ -0,0 +1,37 @@
import { Timestamp } from "firebase/firestore";
import { v4 as uuidv4 } from "uuid";
export default class OfficeRoom {
id: string = uuidv4();
teamId: string;
name: string; // entrance, kitchen, etc.
createdDate: Timestamp;
createdByUserId: string;
lastUpdatedDate: Timestamp;
members: string[] = []; // id's of users in the office room
state: OfficeRoomState;
constructor(
_name: string,
_teamId: string,
_createdBy: string,
_state: OfficeRoomState = OfficeRoomState.idle
) {
this.name = _name;
this.teamId = _teamId;
this.createdByUserId = _createdBy;
this.state = _state;
}
}
export enum OfficeRoomState {
active = "active",
idle = "idle",
archived = "archived",
}
+50
View File
@@ -0,0 +1,50 @@
import { Timestamp } from "firebase/firestore";
export default class Room {
id: string;
name: string;
description: string;
link: string; // google meet link for now
members: string[] = []; //userIds of "mandatory"/invited people including the person who created it
membersInRoom: string[] = [];
attachments: string[] = []; // the links themselves (NOT Ids)...there will be duplicate entries in the attachments table which will be created
type: RoomType;
status: RoomStatus = RoomStatus.empty;
approximateDateTime: string; // vaguely say when the meeting should be...give user pointers
scheduledDateTime: Timestamp;
// scheduledJsDateTime(): Date {
// return this.scheduledDateTime.toDate();
// }
createdDate: Timestamp;
// createdJsDate(): Date {
// return this.createdDate.toDate();
// }
createdByUserId: string;
teamId: string;
lastUpdatedDate: Timestamp;
}
export enum RoomType {
now = "now",
scheduled = "scheduled", // one time sort of standard meeting
recurring = "recurring", //daily standup
}
export enum RoomStatus {
live = "live",
empty = "empty",
archived = "archived", // user marks it over
}
+30
View File
@@ -0,0 +1,30 @@
import { Timestamp } from "firebase/firestore";
export class Team {
id: string;
name: string;
status: TeamStatus;
allowedUserCount: number = 2;
// subscriptionPlan: TeamSubscriptionPlan = TeamSubscriptionPlan.basic
companySite: string;
createdByUserId: string;
createdDate: Timestamp;
lastUpdatedDate: Timestamp;
}
export enum TeamStatus {
created = "created",
deactivated = "deactivated",
deleted = "deleted",
}
export enum TeamSubscriptionPlan {
free = "free",
basic = "basic",
pro = "pro",
}
+26
View File
@@ -0,0 +1,26 @@
import { Timestamp } from "firebase/firestore";
export class TeamMember {
id: string;
userId: string;
teamId: string;
inviteEmailAddress: string;
invitedByUserId: string;
role: TeamMemberRole
status: TeamMemberStatus
createdDate: Timestamp
lastUpdatedDate: Timestamp
}
export enum TeamMemberRole {
admin = "admin"
}
export enum TeamMemberStatus {
invited = "invited",
activated = "activated",
deleted = "deleted"
}
+40
View File
@@ -0,0 +1,40 @@
import {
documentId,
Firestore,
serverTimestamp,
Timestamp,
} from "firebase/firestore";
import IFirestoreSerializable from "./firestoreSerializable";
export class User {
id: string;
emailAddress: string;
nickName: string;
firstName: string;
lastName: string;
avatarUrl: string;
userStatus: UserStatus;
/**designer? dev? */
teamRole: string;
createdDate: Timestamp;
lastUpdatedDate: Timestamp;
// serialize() {
// return {
// createdDate: Timestamp.fromDate(this.createdDate),
// lastUpdatedDate: Timestamp.fromDate(this.lastUpdatedDate)
// }
// }
// deserialize(firestoreData: {}) {
// this.lastUpdatedDate = firestoreData.lastUpdatedDate.toDate()
// }
}
export enum UserStatus {
online = "online",
offline = "offline",
busy = "busy",
}