Fixed friends

- fixed friends field in gql api
pull/2/head
Trivernis 5 years ago
parent 8dd1edd817
commit ba828da18a

@ -44,7 +44,7 @@ export class User extends Model<User> {
public rankpoints: number; public rankpoints: number;
@BelongsToMany(() => User, () => Friendship) @BelongsToMany(() => User, () => Friendship)
public friends: User[]; public rFriends: User[];
@BelongsToMany(() => Post, () => PostVote) @BelongsToMany(() => Post, () => PostVote)
public votes: Array<Post & {PostVote: PostVote}>; public votes: Array<Post & {PostVote: PostVote}>;
@ -78,6 +78,10 @@ export class User extends Model<User> {
return this.getDataValue("createdAt"); return this.getDataValue("createdAt");
} }
public async friends(): Promise<User[]> {
return await this.$get("rFriends") as User[];
}
public async chats(): Promise<ChatRoom[]> { public async chats(): Promise<ChatRoom[]> {
return await this.$get("rChats") as ChatRoom[]; return await this.$get("rChats") as ChatRoom[];
} }

Loading…
Cancel
Save