-
Notifications
You must be signed in to change notification settings - Fork 0
#177 [feat] API 추가 #185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
#177 [feat] API 추가 #185
Changes from all commits
d2c7668
5aca561
32be7f3
58df02a
c5a405a
948f856
ac71dd8
6a093c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,7 +69,7 @@ public ResponseEntity<SuccessResponse<AuthResponse>> processSignIn(@Valid @Reque | |
| @Operation(summary = "회원 가입", description = "회원 가입을 진행합니다.") | ||
| public ResponseEntity<SuccessResponse<SignUpResponse>> processSignup( | ||
| @RequestHeader("Authorization") @NotEmpty(message = "임시 토큰이 누락되었습니다.") String authorization, | ||
| @Valid @RequestBody SignupRequest request | ||
| @RequestBody SignupRequest request | ||
| ) { | ||
| return ResponseEntity.ok(SuccessResponse.of(SuccessCode.SUCCESS_CREATE, authService.register(authorization, request))); | ||
| } | ||
|
Comment on lines
70
to
75
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
🔧 수정 제안 public ResponseEntity<SuccessResponse<SignUpResponse>> processSignup(
@RequestHeader("Authorization") @NotEmpty(message = "임시 토큰이 누락되었습니다.") String authorization,
- @RequestBody SignupRequest request
+ @Valid @RequestBody SignupRequest request
) {🤖 Prompt for AI Agents |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,8 +2,7 @@ | |
|
|
||
| import io.swagger.v3.oas.annotations.Operation; | ||
| import io.swagger.v3.oas.annotations.tags.Tag; | ||
| import jakarta.validation.constraints.NotEmpty; | ||
| import jakarta.validation.constraints.Size; | ||
| import jakarta.validation.Valid; | ||
| import lombok.RequiredArgsConstructor; | ||
| import lombok.extern.slf4j.Slf4j; | ||
| import org.sopt.certi_server.domain.user.dto.request.*; | ||
|
|
@@ -61,7 +60,7 @@ public ResponseEntity<SuccessResponse<PersonalInformationResponse>> getPersonalI | |
| @Operation(summary = "개인정보 수정 API", description = "개인정보를 수정합니다.") | ||
| public ResponseEntity<SuccessResponse<Void>> putPersonalInformation( | ||
| @AuthenticationPrincipal Long userId, | ||
| @RequestBody UpdateUserRequest request | ||
| @Valid @RequestBody UpdateUserRequest request | ||
| ){ | ||
| userService.updateUserInformation(userId, request); | ||
| return ResponseEntity.ok(SuccessResponse.of(SuccessCode.SUCCESS_UPDATE)); | ||
|
|
@@ -122,4 +121,30 @@ public ResponseEntity<SuccessResponse<GetTrackResponse>> getUserTrack( | |
| ){ | ||
| return ResponseEntity.ok(SuccessResponse.of(SuccessCode.SUCCESS_FETCH, userService.getTrack(userId))); | ||
| } | ||
|
|
||
| @GetMapping(value = "/presigned-url") | ||
| @Operation(summary = "presigned URL 반환 API", description = "Presigned URL을 반환합니다. 해당 URL을 통해 이미지를 업로드 할 수 있습니다.") | ||
| public ResponseEntity<SuccessResponse<GetPreSignedURLResponse>> getPreSignedURL( | ||
| @AuthenticationPrincipal Long userId | ||
| ){ | ||
| return ResponseEntity.ok(SuccessResponse.of(SuccessCode.SUCCESS_FETCH, userService.getPreSignedURL(userId))); | ||
| } | ||
|
Comment on lines
+125
to
+131
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Presigned URL API가 “업/다운로드 모두” 요구사항을 충족하는지 확인 필요해요. 🤖 Prompt for AI Agents |
||
|
|
||
|
|
||
| @GetMapping(value = "/marketing-agreement") | ||
| @Operation(summary = "광고성 수신 정보 동의 조회 API", description = "광고성 수신 정보 동의 정보를 조회합니다.") | ||
| public ResponseEntity<SuccessResponse<MarketingResponse>> getMarketingAgreeInformation( | ||
| @AuthenticationPrincipal Long userId | ||
| ){ | ||
| return ResponseEntity.ok(SuccessResponse.of(SuccessCode.SUCCESS_FETCH, userService.getMarketingAgree(userId))); | ||
| } | ||
|
|
||
| @PatchMapping(value = "/marketing-agreement") | ||
| @Operation(summary = "광고성 수신 정보 동의 토글 API", description = "광고성 수신 정보 동의를 토글식으로 변경합니다.") | ||
| public ResponseEntity<SuccessResponse<Void>> patchMarketingAgree( | ||
| @AuthenticationPrincipal Long userId | ||
| ){ | ||
| userService.toggleMarketingAgree(userId); | ||
| return ResponseEntity.ok(SuccessResponse.of(SuccessCode.SUCCESS_UPDATE)); | ||
| } | ||
|
Comment on lines
+142
to
+149
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major 마케팅 동의 “토글”은 재시도에 취약(비멱등)해서 운영 리스크가 있어요. 제안(개념) 변경 예시- @PatchMapping(value = "/marketing-agreement")
- public ResponseEntity<SuccessResponse<Void>> patchMarketingAgree(@AuthenticationPrincipal Long userId){
- userService.toggleMarketingAgree(userId);
- return ResponseEntity.ok(SuccessResponse.of(SuccessCode.SUCCESS_UPDATE));
- }
+ @PutMapping(value = "/marketing-agreement")
+ public ResponseEntity<SuccessResponse<Void>> putMarketingAgree(
+ @AuthenticationPrincipal Long userId,
+ @RequestBody MarketingAgreementRequest request
+ ){
+ userService.setMarketingAgree(userId, request.agree());
+ return ResponseEntity.ok(SuccessResponse.of(SuccessCode.SUCCESS_UPDATE));
+ }🤖 Prompt for AI Agents |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| package org.sopt.certi_server.domain.user.dto.request; | ||
|
|
||
| public record PatchUserProfileImageRequest( | ||
| String publicURL | ||
| ) { | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| package org.sopt.certi_server.domain.user.dto.response; | ||
|
|
||
| public record GetPreSignedURLResponse( | ||
| String preSignedURL, | ||
| String publicURL | ||
| ) { | ||
| public static GetPreSignedURLResponse of( | ||
| String preSignedURL, | ||
| String publicURL | ||
| ){ | ||
| return new GetPreSignedURLResponse( | ||
| preSignedURL, | ||
| publicURL | ||
| ); | ||
| } | ||
|
|
||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package org.sopt.certi_server.domain.user.dto.response; | ||
|
|
||
| public record MarketingResponse( | ||
| boolean isAdAgreed | ||
| ) { | ||
| public static MarketingResponse of(boolean isAdAgreed){ | ||
| return new MarketingResponse(isAdAgreed); | ||
| }; | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -61,6 +61,9 @@ public class User extends BaseTimeEntity { | |||||||||||||
| @Column(name = "birth_date") | ||||||||||||||
| private LocalDate birthDate; | ||||||||||||||
|
|
||||||||||||||
| @Column(name = "marketing_agree") | ||||||||||||||
| private Boolean marketingAgree; | ||||||||||||||
|
|
||||||||||||||
|
Comment on lines
+64
to
+66
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
🤖 Prompt for AI Agents |
||||||||||||||
|
|
||||||||||||||
| public User(String nickname, String email, String profileImageUrl) { | ||||||||||||||
| this.nickname = nickname; | ||||||||||||||
|
|
@@ -70,7 +73,7 @@ public User(String nickname, String email, String profileImageUrl) { | |||||||||||||
|
|
||||||||||||||
| @Builder | ||||||||||||||
| public User(Long id, University university, String track, String grade, MajorImpl major, String nickname, String name, String email, | ||||||||||||||
| String profileImageUrl, SocialType socialType, Long socialId) { | ||||||||||||||
| String profileImageUrl, SocialType socialType, Long socialId, Boolean marketingAgree) { | ||||||||||||||
| this.id = id; | ||||||||||||||
| this.university = university; | ||||||||||||||
| this.track = TrackType.from(track); | ||||||||||||||
|
|
@@ -82,13 +85,15 @@ public User(Long id, University university, String track, String grade, MajorImp | |||||||||||||
| this.profileImageUrl = profileImageUrl; | ||||||||||||||
| this.socialType = socialType; | ||||||||||||||
| this.socialId = socialId; | ||||||||||||||
| this.marketingAgree = marketingAgree; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| public void changeUser(String name, String nickname, String email, LocalDate birthDate){ | ||||||||||||||
| public void changeUser(String name, String nickname, String email, LocalDate birthDate, String profileImageUrl){ | ||||||||||||||
| this.name = name; | ||||||||||||||
| this.nickname = nickname; | ||||||||||||||
| this.email = email; | ||||||||||||||
| this.birthDate = birthDate; | ||||||||||||||
| this.profileImageUrl = profileImageUrl; | ||||||||||||||
| } | ||||||||||||||
|
Comment on lines
+91
to
97
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: rg -n --type=java -C3 '\.changeUser\s*\('Repository: cerdeuk/CERTI-BE Length of output: 780 🏁 Script executed: cat -n src/main/java/org/sopt/certi_server/domain/user/service/UserService.java | sed -n '140,170p'Repository: cerdeuk/CERTI-BE Length of output: 1289 🏁 Script executed: fd -t f 'UpdateUserRequest' --type f | head -5Repository: cerdeuk/CERTI-BE Length of output: 229 🏁 Script executed: cat -n src/main/java/org/sopt/certi_server/domain/user/dto/request/UpdateUserRequest.javaRepository: cerdeuk/CERTI-BE Length of output: 1095 🏁 Script executed: rg -n --type=java 'updateUserInformation' | head -20Repository: cerdeuk/CERTI-BE Length of output: 525 🏁 Script executed: cat -n src/main/java/org/sopt/certi_server/domain/user/controller/UserController.java | sed -n '55,75p'Repository: cerdeuk/CERTI-BE Length of output: 1145
🤖 Prompt for AI Agents |
||||||||||||||
|
|
||||||||||||||
| public void changeUniversity(University university) { | ||||||||||||||
|
|
@@ -98,4 +103,12 @@ public void changeUniversity(University university) { | |||||||||||||
| public void changeMajor(MajorImpl mi) { | ||||||||||||||
| this.major = mi; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| public void updateMarketingAgree() { | ||||||||||||||
| this.marketingAgree = !this.marketingAgree; | ||||||||||||||
| } | ||||||||||||||
|
Comment on lines
+107
to
+109
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
제안 수정안(널 안전 토글)@@
public void updateMarketingAgree() {
- this.marketingAgree = !this.marketingAgree;
+ this.marketingAgree = !Boolean.TRUE.equals(this.marketingAgree);
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
|
|
||||||||||||||
| public void updateProfileImage(String publicKey) { | ||||||||||||||
| this.profileImageUrl = publicKey; | ||||||||||||||
| } | ||||||||||||||
|
Comment on lines
+111
to
+113
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Search for updateProfileImage and profileImageUrl usage patterns
rg -n --type=java -C3 '\bupdateProfileImage\b|\bprofileImageUrl\b|getProfileImageUrl\s*\(' src/Repository: cerdeuk/CERTI-BE Length of output: 12510 🏁 Script executed: #!/bin/bash
# Find the PatchUserProfileImageRequest DTO
rg -n --type=java 'class PatchUserProfileImageRequest|record PatchUserProfileImageRequest' -A 10 src/Repository: cerdeuk/CERTI-BE Length of output: 518 메서드 파라미터명을
🤖 Prompt for AI Agents |
||||||||||||||
| } | ||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.