UNPKG

@wearesage/schema

Version:

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

51 lines (41 loc) 842 B
import "reflect-metadata"; import { Entity, Id, Property, ManyToOne } from "../.."; import { User } from "./User"; import { Post } from "./Post"; @Entity() export class Notification { @Id() id: string; @Property({ required: true }) type: string; @Property({ required: true }) content: string; @Property() isRead: boolean = false; @Property() createdAt: Date; @ManyToOne({ target: () => User, inverse: null, name: "NOTIFIES", }) recipient: User; @ManyToOne({ target: () => User, inverse: null, name: "TRIGGERED_BY", }) triggeredBy: User; @ManyToOne({ target: () => Post, inverse: null, name: "RELATED_TO_POST", }) relatedPost: Post; @ManyToOne({ target: () => Comment, inverse: null, name: "RELATED_TO_COMMENT", }) relatedComment: Comment; }