Skip to content

Instantly share code, notes, and snippets.

@seandearnaley
Created June 8, 2020 15:55
Show Gist options
  • Save seandearnaley/51229be0cad2eea7246b714a77e0b2f7 to your computer and use it in GitHub Desktop.
Save seandearnaley/51229be0cad2eea7246b714a77e0b2f7 to your computer and use it in GitHub Desktop.
BrainStrike Card Entity / Model
import { Entity, PrimaryGeneratedColumn, Column, ManyToMany } from "typeorm";
import { Category } from "./Category";
@Entity()
export class Card {
@PrimaryGeneratedColumn("uuid")
id: string;
@Column()
number: number;
@Column()
label: string;
@Column("text")
description: string;
@Column({
type: "timestamp",
nullable: false,
default: () => "LOCALTIMESTAMP",
})
created: Date;
@Column({
type: "timestamp",
nullable: false,
default: () => "LOCALTIMESTAMP",
})
updated: Date;
@ManyToMany(() => Category, (category) => category.cards)
categories: Category[];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment