Added ranking fields

- added level and points field on user
pull/2/head
Trivernis 5 years ago
parent 43fbb5a6f2
commit e854dc2687

@ -101,6 +101,12 @@ interface UserData {
"all friends of the user"
friends: [User]
"the points of the user"
points: Int
"the levels of the user depending on the points"
level: Int
}
"represents a single user account"
@ -128,6 +134,12 @@ type User implements UserData{
"all friends of the user"
friends: [User]
"the points of the user"
points: Int
"the levels of the user depending on the points"
level: Int
}
type Profile implements UserData {
@ -173,6 +185,11 @@ type Profile implements UserData {
"all groups the user has joined"
groups: [Group]
"the points of the user"
points: Int
"the levels of the user depending on the points"
level: Int
}
"represents a single user post"

@ -90,6 +90,14 @@ export class User extends Model<User> {
return this.getDataValue("createdAt");
}
public get points(): number {
return this.rankpoints;
}
public get level(): number {
return Math.ceil(this.rankpoints / 100);
}
public async friends(): Promise<User[]> {
return await this.$get("rFriends") as User[];
}

Loading…
Cancel
Save