From faa2e47b6718c59feadecea176020f3326076d5d Mon Sep 17 00:00:00 2001 From: transtrike Date: Thu, 17 Dec 2020 23:05:20 +0200 Subject: Implemented Friends layer --- src/DevHive.Services/Services/UserService.cs | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) (limited to 'src/DevHive.Services/Services/UserService.cs') diff --git a/src/DevHive.Services/Services/UserService.cs b/src/DevHive.Services/Services/UserService.cs index 3e65dab..6f69d6d 100644 --- a/src/DevHive.Services/Services/UserService.cs +++ b/src/DevHive.Services/Services/UserService.cs @@ -72,13 +72,7 @@ namespace DevHive.Services.Services User user = await this._userRepository.GetByIdAsync(id) ?? throw new ArgumentException("User does not exist!"); - //Here User has 1 role - - UserServiceModel model = this._userMapper.Map(user); - - //here model has 0 roles - - return model; + return this._userMapper.Map(user); } public async Task UpdateUser(UpdateUserServiceModel updateModel) @@ -111,16 +105,6 @@ namespace DevHive.Services.Services throw new InvalidOperationException("Unable to delete user!"); } - public async Task AddFriend(Guid userId, Guid friendId) - { - User user = await this._userRepository.GetByIdAsync(userId); - User friend = await this._userRepository.GetByIdAsync(friendId); - - return user != default(User) && friend != default(User) ? - await this._userRepository.AddFriend(user, friend) : - throw new ArgumentException("Invalid user!"); - } - private string GeneratePasswordHash(string password) { return string.Join(string.Empty, SHA512.HashData(Encoding.ASCII.GetBytes(password))); -- cgit v1.2.3