This repository has been archived by the owner on Nov 7, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
alliance.dto.ts
95 lines (84 loc) 路 2.63 KB
/
alliance.dto.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import { DCorporationShortWithoutAlliance } from '../corporation/corporation.dto';
import { Alliance } from './alliance.entity';
import { DPagination } from '../../dto/paggination.dto';
import { IAllianceName } from '../common/external/esi/esi.interface';
import { IAllianceIcon } from './alliance.interface';
export class DAllianceIcon {
px64x64: string;
px128x128: string;
constructor(icon: IAllianceIcon) {
this.px64x64 = icon.px64x64;
this.px128x128 = icon.px128x128;
}
}
export class DAllianceName {
id: number;
name: string;
constructor(alliance: IAllianceName) {
this.id = alliance.alliance_id;
this.name = alliance.alliance_name;
}
}
export class DAllianceShort {
id: number;
name: string;
handle: string;
ticker: string;
dateFounded: Date;
icon: DAllianceIcon;
constructor(alliance: Alliance) {
this.id = alliance.id;
this.name = alliance.name;
this.handle = alliance.handle;
this.ticker = alliance.ticker;
this.dateFounded = alliance.dateFounded;
this.icon = new DAllianceIcon(alliance.icon);
}
}
export class DAlliance {
id: number;
name: string;
handle: string;
ticker: string;
dateFounded: Date;
executorCorporation: DCorporationShortWithoutAlliance;
icon: DAllianceIcon;
/* LIVE Data */
hasSupers: boolean;
iskDestroyed: number;
iskLost: number;
pointsDestroyed: number;
pointsLost: number;
shipsDestroyed: number;
shipsLost: number;
soloKills: number;
soloLosses: number;
memberCount: number;
corpCount: number;
constructor(alliance: Alliance) {
this.id = alliance.id;
this.name = alliance.name;
this.handle = alliance.handle;
this.ticker = alliance.ticker;
this.dateFounded = alliance.dateFounded;
this.executorCorporation = new DCorporationShortWithoutAlliance(alliance.executorCorporation);
this.icon = new DAllianceIcon(alliance.icon);
this.hasSupers = alliance.hasSupers;
this.iskDestroyed = alliance.iskDestroyed;
this.iskLost = alliance.iskLost;
this.pointsDestroyed = alliance.pointsDestroyed;
this.pointsLost = alliance.pointsLost;
this.shipsDestroyed = alliance.shipsDestroyed;
this.shipsLost = alliance.shipsLost;
this.soloKills = alliance.soloKills;
this.soloLosses = alliance.soloLosses;
this.memberCount = alliance.memberCount;
this.corpCount = alliance.corpCount;
}
}
export class DAllianceList extends DPagination<DAllianceShort> {
constructor(alliances: Alliance[], page: number, perPage: number, count: number) {
const formattedAlliances = alliances.map(alliance => new DAllianceShort(alliance));
super(formattedAlliances, page, perPage, count);
}
}