using ShoppingAssistantApi.Application.IServices.Identity; using ShoppingAssistantApi.Application.Models.Dtos; using ShoppingAssistantApi.Application.Models.Operations; using HotChocolate.Authorization; namespace ShoppingAssistantApi.Api.Mutations; [ExtendObjectType(OperationTypeNames.Mutation)] public class UsersMutation { [Authorize] public Task UpdateUserAsync(UserDto userDto, CancellationToken cancellationToken, [Service] IUserManager userManager) => userManager.UpdateAsync(userDto, cancellationToken); [Authorize] public Task UpdateUserByAdminAsync(string id, UserDto userDto, CancellationToken cancellationToken, [Service] IUserManager userManager) => userManager.UpdateUserByAdminAsync(id, userDto, cancellationToken); [Authorize] public Task AddToRoleAsync(string roleName, string userId, CancellationToken cancellationToken, [Service] IUserManager userManager) => userManager.AddToRoleAsync(roleName, userId, cancellationToken); [Authorize] public Task RemoveFromRoleAsync(string roleName, string userId, CancellationToken cancellationToken, [Service] IUserManager userManager) => userManager.RemoveFromRoleAsync(roleName, userId, cancellationToken); }