UNPKG

@wearesage/schema

Version:

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

38 lines (31 loc) 693 B
import "reflect-metadata"; import { Entity, Id, Property, OneToMany, ManyToMany } from "../.."; import { User } from "./User"; import { Project } from "./Project"; @Entity() export class Organization { @Id() id: string; @Property({ required: true }) name: string; @Property() description: string; @OneToMany({ target: () => Project, inverse: "organization", name: "OWNS_PROJECT", }) projects: Project[] = []; @ManyToMany({ target: () => User, inverse: "organizations", name: "HAS_MEMBER", }) members: User[] = []; @OneToMany({ target: () => User, inverse: "ownedOrganization", name: "OWNED_BY", }) owners: User[] = []; }