Skip to content

Commit afae9a5

Browse files
committed
[REFACTOR] Apple Social ID 동기화 API 엔드포인트 추가
- PATCH /auth/apple/sync 매핑 - AuthController에서 AppleService 호출 연결
1 parent 22cc25d commit afae9a5

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/main/java/org/websoso/WSSServer/controller/AuthController.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
import org.springframework.http.ResponseEntity;
99
import org.springframework.security.access.prepost.PreAuthorize;
1010
import org.springframework.security.core.annotation.AuthenticationPrincipal;
11+
import org.springframework.web.bind.annotation.PatchMapping;
1112
import org.springframework.web.bind.annotation.PostMapping;
1213
import org.springframework.web.bind.annotation.RequestBody;
1314
import org.springframework.web.bind.annotation.RequestHeader;
1415
import org.springframework.web.bind.annotation.RestController;
16+
import org.websoso.WSSServer.dto.auth.AppleIdUpdateRequest;
1517
import org.websoso.WSSServer.user.domain.User;
1618
import org.websoso.WSSServer.dto.auth.AppleLoginRequest;
1719
import org.websoso.WSSServer.dto.auth.AuthResponse;
@@ -54,6 +56,21 @@ public ResponseEntity<AuthResponse> loginByApple(@Valid @RequestBody AppleLoginR
5456
.body(appleService.getUserInfoFromApple(request));
5557
}
5658

59+
@PatchMapping("/auth/apple/sync")
60+
public ResponseEntity<Void> updateAppleSocialId(
61+
@AuthenticationPrincipal User user,
62+
@Valid @RequestBody AppleIdUpdateRequest request
63+
) {
64+
if (!request.authorizationCode().isBlank() && !request.idToken().isBlank()) {
65+
appleService.syncSocialId(user, request);
66+
}
67+
68+
return ResponseEntity
69+
.status(NO_CONTENT)
70+
.build();
71+
}
72+
73+
5774
@PostMapping("/auth/logout")
5875
@PreAuthorize("isAuthenticated()")
5976
public ResponseEntity<Void> logout(@AuthenticationPrincipal User user,

0 commit comments

Comments
 (0)