chamesu
Version:
This package contains all packages of the chat application.
60 lines (46 loc) • 1.43 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,
PrimaryGeneratedColumn,
UpdateDateColumn
} from "typeorm";
import {ChatRoom} from "../room";
import {AuthUser} from "../../auth/user";
import {ChatMember} from "../member";
()
export class ChatMessage {
({type: "int", unsigned: true})
id!: number;
({type: "text"})
content!: string;
({type: "boolean", default: false})
encrypted!: boolean | null;
({type: "varchar", nullable: true})
nonce!: string | null;
()
created_at!: string;
()
updated_at!: string
({type: "int", unsigned: true})
user_id!: number;
({type: "varchar"})
room_id!: string;
({type: "varchar", nullable: true})
member_id!: string;
(() => AuthUser, { onDelete: 'CASCADE' })
({name: 'user_id'})
user!: AuthUser;
(() => ChatRoom, {onDelete: "CASCADE"})
({name: 'room_id'})
room!: ChatRoom;
(() => ChatMember, { onDelete: 'SET NULL', nullable: true })
({name: 'member_id'})
member!: ChatMember | null;
}