UNPKG

@wearesage/schema

Version:

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

31 lines (25 loc) 507 B
import "reflect-metadata"; import { Entity, Id, Property, ManyToOne } from "../.."; import { Task } from "./Task"; import { User } from "./User"; @Entity() export class Comment { @Id() id: string; @Property({ required: true }) content: string; @Property() createdAt: Date; @ManyToOne({ target: () => Task, inverse: "comments", name: "BELONGS_TO_TASK", }) task: Task; @ManyToOne({ target: () => User, inverse: null, name: "CREATED_BY", }) author: User; }