Completed
Push — master ( e65836...fa4d5c )
by Mathieu
12s queued 10s
created

server/src/Domain/Customer/Customer.entity.ts   A

Complexity

Total Complexity 5
Complexity/F 1

Size

Lines of Code 43
Function Count 5

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

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

5 Functions

Rating   Name   Duplication   Size   Complexity  
A Customer.getAddress 0 3 1
A Customer.getId 0 3 1
A Customer.getCreatedAt 0 3 1
A Customer.getName 0 3 1
A Customer.updateName 0 3 1
1
import {Entity, Column, PrimaryGeneratedColumn, ManyToOne} from 'typeorm';
2
import {Address} from './Address.entity';
3
4
@Entity()
5
export class Customer {
6
  @PrimaryGeneratedColumn('uuid')
7
  private id: string;
8
9
  @Column({type: 'varchar', nullable: false})
10
  private name: string;
11
12
  @Column({type: 'timestamp', default: () => 'CURRENT_TIMESTAMP'})
13
  private createdAt: Date;
14
15
  @ManyToOne(type => Address, {nullable: true, onDelete: 'SET NULL'})
16
  private address: Address;
17
18
  constructor(name: string, address: Address) {
19
    this.name = name;
20
    this.address = address;
21
  }
22
23
  public getId(): string {
24
    return this.id;
25
  }
26
27
  public getName(): string {
28
    return this.name;
29
  }
30
31
  public getCreatedAt(): Date {
32
    return this.createdAt;
33
  }
34
35
  public getAddress(): Address {
36
    return this.address;
37
  }
38
39
  public updateName(name: string): void {
40
    this.name = name;
41
  }
42
}
43