api/src/Domain/School/Voucher.entity.ts   A
last analyzed

Complexity

Total Complexity 5
Complexity/F 1

Size

Lines of Code 47
Function Count 5

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 39
mnd 0
bc 0
fnc 5
dl 0
loc 47
rs 10
bpm 0
cpm 1
noi 0
c 0
b 0
f 0

5 Functions

Rating   Name   Duplication   Size   Complexity  
A Voucher.getId 0 3 1
A Voucher.getCreatedAt 0 3 1
A Voucher.getSchool 0 3 1
A Voucher.getCode 0 3 1
A Voucher.getEmail 0 3 1
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