File tree Expand file tree Collapse file tree 1 file changed +26
-7
lines changed Expand file tree Collapse file tree 1 file changed +26
-7
lines changed Original file line number Diff line number Diff line change 1+ // Clan structure in database
2+ interface ClanData {
3+ name : string ;
4+ leader : string ;
5+ cr : number ;
6+ members : string | Array < string > ;
7+ description : string ;
8+ joinable : number ;
9+ tag : string ;
10+ }
11+
112// Used to represent a clan
213export default class Clan {
14+ // The name of this clan
15+ public name : string ;
316 // The leader of this clan
417 public leader : string ;
518 // The rating of this clan (signed)
619 public cr : number ;
720 // Raw string of all members (split by , to get an array)
8- public members : string ;
21+ public members : Array < string > ;
922 // The clan description
1023 public description : string ;
24+ // Whether this clan is joinable or not
25+ public joinable : boolean ;
26+ // The tag of this clan (1-4 characteres)
27+ public tag : string ;
1128
12- constructor ( leader : string , cr : number , members : string , description : string ) {
13- // Store local variables
14- this . leader = leader ;
15- this . cr = cr ;
16- this . members = members ;
17- this . description = description ;
29+ constructor ( data : ClanData ) {
30+ this . cr = data . cr ;
31+ this . description = data . description ;
32+ this . joinable = typeof data . joinable === "number" ? Boolean ( data . joinable ) : data . joinable ;
33+ this . leader = data . leader ;
34+ this . members = typeof data . members === "string" ? JSON . parse ( data . members ) : data . members ;
35+ this . name = data . name ;
36+ this . tag = data . tag ;
1837 }
1938}
You can’t perform that action at this time.
0 commit comments