chamesu
Version:
This package contains all packages of the chat application.
70 lines (55 loc) • 1.57 kB
text/typescript
/*
* Copyright (c) 2022.
* Author Peter Placzek (tada5hi)
* For the full copyright and license information,
* view the LICENSE file that was distributed with this source code.
*/
import {
Column,
CreateDateColumn,
Entity, JoinColumn, ManyToOne, OneToMany,
PrimaryGeneratedColumn,
UpdateDateColumn
} from "typeorm";
import {ChatMember} from "../member";
import {AuthContact} from "../../auth/contact";
export enum ChatRoomType {
PRIVATE = 'private',
CHANNEL = 'channel',
GROUP = 'group'
}
()
export class ChatRoom {
("uuid")
id: string;
({type: 'varchar', length: 100, nullable: true})
name: string;
({type: "varchar", nullable: true})
description: string;
({
type: "enum",
enum: ChatRoomType,
default: ChatRoomType.CHANNEL
})
type: string;
({type: "boolean", default: false})
encryption: boolean;
({type: 'boolean', default: false})
protected: boolean;
({type: "varchar", nullable: true})
password: string;
(() => ChatMember, (chatMember) => chatMember.room, {onDelete: "CASCADE"})
members: ChatMember[];
/*
Meta
*/
({type: "varchar", nullable: true, default: null})
contact_id: string;
(() => AuthContact, {nullable: true, onDelete: "SET NULL"})
({name: 'contact_id'})
contact: AuthContact;
()
created_at: string;
()
updated_at: string
}