Created
June 8, 2020 15:55
-
-
Save seandearnaley/51229be0cad2eea7246b714a77e0b2f7 to your computer and use it in GitHub Desktop.
BrainStrike Card Entity / Model
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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