UNPKG

@wearesage/schema

Version:

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

46 lines (39 loc) 678 B
import "reflect-metadata"; import { Entity, Id, Property, OneToMany, OneToOne, ManyToOne, ManyToMany, } from "../.."; import { User } from "./User"; import { Post } from "./Post"; @Entity() export class Reaction { @Id() id: string; @Property({ required: true }) type: string; @Property() createdAt: Date; @ManyToOne({ target: () => User, inverse: null, name: "CREATED_BY", }) user: User; @ManyToOne({ target: () => Post, inverse: "reactions", name: "BELONGS_TO_POST", }) post: Post; @ManyToOne({ target: () => Comment, inverse: "reactions", name: "BELONGS_TO_COMMENT", }) comment: Comment; }