| Total Complexity | 5 |
| Complexity/F | 1 |
| Lines of Code | 47 |
| Function Count | 5 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { Entity, Column, PrimaryGeneratedColumn, ManyToOne } from 'typeorm'; |
||
| 2 | import { School } from './School.entity'; |
||
| 3 | |||
| 4 | @Entity() |
||
| 5 | export class Voucher { |
||
| 6 | @PrimaryGeneratedColumn('uuid') |
||
| 7 | private id: string; |
||
| 8 | |||
| 9 | @Column({type: 'varchar', nullable: false}) |
||
| 10 | private code: string; |
||
| 11 | |||
| 12 | @Column({type: 'varchar', nullable: false}) |
||
| 13 | private email: string; |
||
| 14 | |||
| 15 | @ManyToOne(() => School, {onDelete: 'CASCADE', nullable: false}) |
||
| 16 | private school: School; |
||
| 17 | |||
| 18 | @Column({type: 'timestamp', default: () => 'CURRENT_TIMESTAMP'}) |
||
| 19 | private createdAt: string; |
||
| 20 | |||
| 21 | constructor(code: string, email: string, school: School) { |
||
| 22 | this.code = code; |
||
| 23 | this.email = email; |
||
| 24 | this.school = school; |
||
| 25 | } |
||
| 26 | |||
| 27 | public getId(): string { |
||
| 28 | return this.id; |
||
| 29 | } |
||
| 30 | |||
| 31 | public getCode(): string { |
||
| 32 | return this.code; |
||
| 33 | } |
||
| 34 | |||
| 35 | public getEmail(): string { |
||
| 36 | return this.email; |
||
| 37 | } |
||
| 38 | |||
| 39 | public getSchool(): School { |
||
| 40 | return this.school; |
||
| 41 | } |
||
| 42 | |||
| 43 | public getCreatedAt(): string { |
||
| 44 | return this.createdAt; |
||
| 45 | } |
||
| 46 | } |
||
| 47 |