UNPKG

@wearesage/schema

Version:

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

27 lines (21 loc) 427 B
import "reflect-metadata"; import { Entity, Id, Property, ManyToMany } from "../.."; import { Post } from "./Post"; @Entity() export class Tag { @Id() id: string; @Property({ required: true, unique: true }) name: string; // Timestamps @Property() createdAt: Date; @Property() updatedAt: Date; @ManyToMany({ target: () => Post, inverse: "tags", name: "HAS_TAG", }) posts: Post[] = []; }