Merge branch 'develop' of Software_Engineering_I/greenvironment-server into master

pull/5/head
Trivernis 5 years ago committed by Gitea
commit 529de498df

@ -291,14 +291,16 @@ export class User extends Model<User> {
public async friends({first, offset}: { first: number, offset: number }): Promise<User[]> { public async friends({first, offset}: { first: number, offset: number }): Promise<User[]> {
const limit = first ?? 10; const limit = first ?? 10;
offset = offset ?? 0; offset = offset ?? 0;
return await this.$get("rFriendOf", {limit, offset}) as User[]; const friendList = await this.$get("rFriendOf", {limit, offset}) as User[];
friendList.concat(await this.$get("rFriends", {limit, offset}) as User[]);
return friendList.slice(0, limit);
} }
/** /**
* The total number of the users friends. * The total number of the users friends.
*/ */
public async friendCount(): Promise<number> { public async friendCount(): Promise<number> {
return this.$count("rFriends"); return await this.$count("rFriends") + await this.$count("rFriendOf");
} }
/** /**

Loading…
Cancel
Save