Skip to content

Commit

Permalink
removed User
Browse files Browse the repository at this point in the history
  • Loading branch information
dadukhankevin committed Jul 7, 2023
1 parent fd761d6 commit 1806ab5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions backend/LexBoxApi/GraphQL/LexMutations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,21 +148,20 @@ public async Task<User> ChangeUserAccountByAdmin(ChangeUserAccountByAdminInput i
[UseMutationConvention]
[AdminRequired]
public async Task<User> DeleteUserByAdmin(DeleteUserByAdminInput input, LexBoxDbContext dbContext){
var User = await dbContext.Users.FindAsync(input.UserId);
var user = dbContext.Users.Where(u => u.Id == input.UserId);
await user.ExecuteDeleteAsync();
return User;
return (LexCore.Entities.User) user;
}

[Error<NotFoundException>]
[Error<DbError>]
[UseMutationConvention]
public async Task<User> DeleteUserByUser(DeleteUserByUserInput input, LexBoxDbContext dbContext){
var user = await dbContext.Users.FindAsync(input.UserId);
if (user is null) throw new NotFoundException("User not found");
if (_loggedInContext.User.Id != input.UserId) throw new UnauthorizedAccessException();
var User = await dbContext.Users.FindAsync(input.UserId);
var del = dbContext.Users.Where(u => u.Id == input.UserId);
await del.ExecuteDeleteAsync();
return User;
return (LexCore.Entities.User) user;
}
}

0 comments on commit 1806ab5

Please sign in to comment.