renaming api
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
export const connectCore = () => {
|
||||
console.log('CONNECTED COREEEE');
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
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 id: string,
|
||||
public creatorUserId: string,
|
||||
public contentUrl: string,
|
||||
|
||||
public contentType: ContentType,
|
||||
public blobType: string,
|
||||
|
||||
public createdDate: Date,
|
||||
) {}
|
||||
}
|
||||
|
||||
export enum ContentType {
|
||||
audio = 'audio',
|
||||
|
||||
link = 'link',
|
||||
|
||||
image = 'image',
|
||||
}
|
||||
|
||||
export function isUrlImage(url: string) {
|
||||
return url.match(/\.(jpeg|jpg|gif|png)$/) != null;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
import { User } from './user.model';
|
||||
export default class Conversation {
|
||||
constructor(
|
||||
public id: string,
|
||||
public createdByUserId: string,
|
||||
|
||||
public memberIdsList: string[],
|
||||
|
||||
public members: MemberMap,
|
||||
|
||||
public userCache: User[],
|
||||
|
||||
public name: string | null = null,
|
||||
|
||||
public lastUpdatedDate: Date,
|
||||
|
||||
public createdDate: Date,
|
||||
|
||||
public membersInRoom: string[] = [],
|
||||
) {}
|
||||
}
|
||||
|
||||
export type MemberMap = {
|
||||
[memberId: string]: ConversationMember;
|
||||
};
|
||||
|
||||
export class ConversationMember {
|
||||
constructor(
|
||||
public userId: string, // NOTE: serves as the user ID
|
||||
|
||||
public role: MemberRole,
|
||||
|
||||
public memberState: MemberState,
|
||||
public isActive: boolean = true,
|
||||
public lastActiveDate: Date,
|
||||
public joinedDate = Date,
|
||||
) {}
|
||||
}
|
||||
|
||||
export enum MemberRole {
|
||||
admin = 'admin',
|
||||
regular = 'regular',
|
||||
}
|
||||
export enum MemberState {
|
||||
priority = 'priority',
|
||||
inbox = 'inbox',
|
||||
// deleted = "deleted"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
export class User {
|
||||
lastUpdatedDate?: Date;
|
||||
|
||||
priorityConversations?: string[]; // id of all priority convos
|
||||
|
||||
constructor(
|
||||
public id: string,
|
||||
public uid: string,
|
||||
public providerId: string,
|
||||
public email: string,
|
||||
public displayName?: string,
|
||||
public photoUrl?: string,
|
||||
public phoneNumber?: string,
|
||||
public createdDate: Date = new Date(),
|
||||
) {}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import express from 'express';
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
router.use(express.json());
|
||||
|
||||
router.post('/login', loginOrCreate);
|
||||
@@ -0,0 +1,5 @@
|
||||
export default class UserService {
|
||||
static async loginOrCreate() {
|
||||
// get the user
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user