Skip to content
Snippets Groups Projects
Commit 4825c66d authored by Matt Kirby's avatar Matt Kirby
Browse files

Added friendManager class

parent 6308af85
No related branches found
No related tags found
1 merge request!15Add Friend service
import FriendDataStore from "../Datastores/FriendDataStore";
import { Friend } from "../Types/Friend";
/**
* Class to handle all friend functionality
*/
export class FriendManager {
public AddFriend = async (user1: string, user2: string): Promise<Friend> => {
return await FriendDataStore.newFriend(user1, user2);
}
public GetFriendIds = async (userId: string): Promise<string[]> => {
const friends = await FriendDataStore.getFriends(userId);
return friends.friends1.map(f => f.User2).concat(friends.friends2.map(f => f.User1));
}
public RemoveFriend = async (user1: string, user2: string): Promise<void> => {
return await FriendDataStore.RemoveFriend(user1, user2);
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment