| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using System.Security.Claims;
- using Application.Abstractions.Messaging;
- using Web.Api.Common;
- using Web.Api.Extensions;
- namespace Web.Api.Endpoints.MyPage;
- /// <summary>
- /// YouTube 연동 해제 — 회원 본인의 YouTube OAuth 권한과 캐시된 YT 데이터를 즉시 폐기.
- /// 회원 탈퇴는 일어나지 않음. YouTube API Services ToS 의 "사용자 데이터 삭제 요청 즉시 처리" 준수.
- /// </summary>
- internal sealed class UnlinkYouTube : IEndpoint
- {
- public void MapEndpoint(IEndpointRouteBuilder app)
- {
- app.MapPost("api/mypage/unlink-youtube", async (
- ClaimsPrincipal user,
- ISender sender,
- CancellationToken ct
- ) => {
- var memberID = user.GetMemberID();
- if (memberID is null)
- {
- return ApiResponse.Fail(StatusCodes.Status401Unauthorized, "Invalid token");
- }
- var command = new Application.Features.Api.MyPage.UnlinkYouTube.Command(memberID.Value);
- var result = await sender.Send(command, ct);
- return result.Match(
- () => ApiResponse.Ok(),
- CustomResults.Problem
- );
- })
- .WithTags("MyPage")
- .WithSummary("YouTube 연동 해제 — OAuth 권한 회수 및 캐시된 YT 데이터 삭제")
- .RequireAuthorization();
- }
- }
|