-
Notifications
You must be signed in to change notification settings - Fork 1
/
user.ts
70 lines (50 loc) · 1.51 KB
/
user.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
import { column, mapping, Mappings, primary, table } from 'hibernatets';
import { ExtendedMap } from 'hibernatets/extended-map/extended-map';
import { v4 as uuid } from 'uuid';
import { FriendShip } from './friendship';
import { InventoryItem } from './inventory/inventory-item';
import { UserAttribute, UserAttributeMap } from './user-attribute';
@table()
export class User {
@primary()
id: number;
@column()
cookie: string;
@column()
pusherUuid: string;
@column()
nickName: string;
@column()
shownCookieHint = false;
@column({ type: 'number' })
readyForFriends: number;
@column({ type: 'number' })
deathCount: number = 0;
@mapping(Mappings.OneToMany, FriendShip, 'originalUser')
friends: Array<FriendShip> = [];
@column({ type: 'boolean' })
adminPrivileges: boolean;
@column({ type: 'boolean' })
gameModeEnabled: boolean;
@column({ type: 'boolean' })
autoOpenGameOverlay: boolean;
@column()
trackedUser: string;
@column()
referenceUuid: string;
@column()
lastDefaultUserUpdate: string
@mapping(Mappings.OneToMany, UserAttribute, 'userRef', {
loadType: 'map'
})
attributes = new ExtendedMap<UserAttribute, UserAttributeMap>(UserAttribute);
@mapping(Mappings.OneToMany, InventoryItem, 'userRef')
inventory: Array<InventoryItem> = [];
constructor(cookie?) {
this.cookie = cookie;
this.referenceUuid = uuid();
}
}
export interface UserRef extends User {
//
}