shopping-assistant-api/ShoppingAssistantApi.Api/Mutations/UsersMutation.cs
2023-09-22 23:02:20 +03:00

20 lines
804 B
C#

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<UpdateUserModel> UpdateUserAsync(UserDto userDto, CancellationToken cancellationToken,
[Service] IUserManager userManager)
=> userManager.UpdateAsync(userDto, cancellationToken);
[Authorize]
public Task<UpdateUserModel> UpdateUserByAdminAsync(string id, UserDto userDto, CancellationToken cancellationToken,
[Service] IUserManager userManager)
=> userManager.UpdateUserByAdminAsync(id, userDto, cancellationToken);
}