-
Notifications
You must be signed in to change notification settings - Fork 0
/
User.js
73 lines (54 loc) · 1.28 KB
/
User.js
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
class User {
constructor(name, gender, birth, country, email, password, photo, admin){
this._name = name;
this._gender = gender;
this._birth = birth;
this._country = country;
this._email = email;
this._password = password;
this._photo = photo;
this._admin = admin;
this._register = new Date();
}
get register(){
return this._register
}
get name(){
return this._name;
}
get gender(){
return this._gender;
}
get birth(){
return this._birth;
}
get country(){
return this._country;
}
get email(){
return this._email;
}
get password(){
return this._password;
}
get photo(){
return this._photo;
}
get admin(){
return this._admin;
}
set photo(value){
this._photo = value;
}
loadFromJSON(json){
for(let name in json){
switch(name){
case '_register' :
this[name] = new Date(json[name]);
break;
default:
this[name] = json[name];
}
}
}
}