UNPKG

@wearesage/schema

Version:

A flexible schema definition and validation system for TypeScript with multi-database support

34 lines (27 loc) 589 B
import "reflect-metadata"; import { Entity, Id, Property, OneToMany, ManyToMany } from "../.."; import { Message } from "./Message"; import { User } from "./User"; @Entity() export class ChatRoom { @Id() id: string; @Property() name: string; @Property() isGroupChat: boolean = false; @Property() createdAt: Date; @OneToMany({ target: () => Message, inverse: "chatRoom", name: "CONTAINS_MESSAGE", }) messages: Message[] = []; @ManyToMany({ target: () => User, inverse: null, name: "HAS_PARTICIPANT", }) participants: User[] = []; }