summary refs log tree commit diff
path: root/util/src/entities/Note.ts
blob: 36017c5eb70cab208b260359338ed142bd9f3d8d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { Column, Entity, JoinColumn, ManyToOne, Unique } from "typeorm";
import { BaseClass } from "./BaseClass";
import { User } from "./User";

@Entity("notes")
@Unique(["owner", "target"])
export class Note extends BaseClass {
	@JoinColumn({ name: "owner_id" })
	@ManyToOne(() => User, { onDelete: "CASCADE" })
	owner: User;

	@JoinColumn({ name: "target_id" })
	@ManyToOne(() => User, { onDelete: "CASCADE" })
	target: User;

	@Column()
	content: string;
}