CrewInviteCode.cs 752 B

1234567891011121314151617181920212223242526
  1. using Web.Api.Common;
  2. using Web.Api.Extensions;
  3. using MediatR;
  4. namespace Web.Api.Endpoints.Studio.Crew;
  5. /// <summary>크루 초대 코드 생성</summary>
  6. internal sealed class CrewInviteCode : IEndpoint
  7. {
  8. public void MapEndpoint(IEndpointRouteBuilder app)
  9. {
  10. app.MapPost("api/studio/crew/invite/generate", async (
  11. Application.Features.Api.Crew.GenerateInviteCode.Command body,
  12. ISender sender,
  13. CancellationToken ct
  14. ) => {
  15. var result = await sender.Send(body, ct);
  16. return result.Match(
  17. data => ApiResponse.Ok(data),
  18. CustomResults.Problem
  19. );
  20. })
  21. .WithTags("StudioCrew")
  22. .RequireAuthorization();
  23. }
  24. }