feat: initial model
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import {
|
||||
Entity,
|
||||
Column,
|
||||
PrimaryGeneratedColumn,
|
||||
Unique,
|
||||
Generated,
|
||||
ManyToOne,
|
||||
} from 'typeorm';
|
||||
import { Poll } from './poll.entity';
|
||||
|
||||
@Entity()
|
||||
@Unique(['value'])
|
||||
export class InviteCode {
|
||||
@PrimaryGeneratedColumn({})
|
||||
id: number;
|
||||
|
||||
@Column()
|
||||
description: string;
|
||||
|
||||
@Column({ nullable: true, default: null })
|
||||
max_usages: number;
|
||||
|
||||
@Column()
|
||||
@Generated('uuid')
|
||||
value: string;
|
||||
|
||||
@ManyToOne(() => Poll, (poll) => poll.codes)
|
||||
poll: Poll;
|
||||
}
|
||||
Reference in New Issue
Block a user