-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from WE-ARE-RACCOONS/RAC-184
- Loading branch information
Showing
16 changed files
with
205 additions
and
110 deletions.
There are no files selected for viewing
23 changes: 2 additions & 21 deletions
23
src/main/java/com/postgraduate/domain/auth/application/dto/req/SeniorChangeRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,7 @@ | ||
package com.postgraduate.domain.auth.application.dto.req; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class SeniorChangeRequest { | ||
@NotNull | ||
private String major; | ||
@NotNull | ||
private String postgradu; | ||
@NotNull | ||
private String professor; | ||
@NotNull | ||
private String lab; | ||
@NotNull | ||
private String field; | ||
@NotNull | ||
private String keyword; | ||
@NotNull | ||
private String certification; | ||
public record SeniorChangeRequest(@NotNull String major, @NotNull String postgradu, @NotNull String professor, | ||
@NotNull String lab, @NotNull String field, @NotNull String keyword, @NotNull String certification) { | ||
} |
33 changes: 4 additions & 29 deletions
33
src/main/java/com/postgraduate/domain/auth/application/dto/req/SeniorSignUpRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,9 @@ | ||
package com.postgraduate.domain.auth.application.dto.req; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class SeniorSignUpRequest { | ||
@NotNull | ||
private Long socialId; | ||
@NotNull | ||
private String phoneNumber; | ||
@NotNull | ||
private String nickName; | ||
@NotNull | ||
private Boolean marketingReceive; | ||
@NotNull | ||
private String major; | ||
@NotNull | ||
private String postgradu; | ||
@NotNull | ||
private String professor; | ||
@NotNull | ||
private String lab; | ||
@NotNull | ||
private String field; | ||
@NotNull | ||
private String keyword; | ||
@NotNull | ||
private String certification; | ||
public record SeniorSignUpRequest(@NotNull Long socialId, @NotNull String phoneNumber, @NotNull String nickName, | ||
@NotNull Boolean marketingReceive, @NotNull String major, @NotNull String postgradu, | ||
@NotNull String professor, @NotNull String lab, @NotNull String field, | ||
@NotNull String keyword, @NotNull String certification) { | ||
} |
2 changes: 1 addition & 1 deletion
2
.../application/dto/PreSignedUrlRequest.java → ...lication/dto/req/PreSignedUrlRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
src/main/java/com/postgraduate/domain/image/application/dto/res/ImageUrlResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.postgraduate.domain.image.application.dto.res; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
|
||
public record ImageUrlResponse(@NotNull String profileUrl) {} |
2 changes: 1 addition & 1 deletion
2
...application/dto/PreSignedUrlResponse.java → ...ication/dto/res/PreSignedUrlResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/java/com/postgraduate/domain/image/application/usecase/ImageUploadUseCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.postgraduate.domain.image.application.usecase; | ||
|
||
import com.postgraduate.domain.image.application.dto.res.ImageUrlResponse; | ||
import com.postgraduate.domain.user.domain.entity.User; | ||
import com.postgraduate.global.config.s3.S3UploadService; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class ImageUploadUseCase { | ||
private final S3UploadService uploadService; | ||
|
||
public ImageUrlResponse uploadCertification(MultipartFile certification) { | ||
String url = uploadService.saveCertificationFile(certification); | ||
return new ImageUrlResponse(url); | ||
} | ||
|
||
public ImageUrlResponse uploadProfile(User user, MultipartFile profile) { | ||
if (user.getProfile() != null) | ||
uploadService.deleteProfileImage(user.getProfile()); | ||
String url = uploadService.saveProfileFile(profile); | ||
return new ImageUrlResponse(url); | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
src/main/java/com/postgraduate/domain/image/application/usecase/PreSignedUseCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/main/java/com/postgraduate/domain/image/exception/DeleteException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.postgraduate.domain.image.exception; | ||
|
||
import static com.postgraduate.domain.image.presentation.constant.ImageResponseCode.IMAGE_DELETE_ERROR; | ||
import static com.postgraduate.domain.image.presentation.constant.ImageResponseMessage.DELETE_ERROR; | ||
|
||
public class DeleteException extends ImageException{ | ||
public DeleteException() { | ||
super(DELETE_ERROR.getMessage(), IMAGE_DELETE_ERROR.getCode()); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/postgraduate/domain/image/exception/UploadException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.postgraduate.domain.image.exception; | ||
|
||
import static com.postgraduate.domain.image.presentation.constant.ImageResponseCode.IMAGE_UPLOAD_ERROR; | ||
import static com.postgraduate.domain.image.presentation.constant.ImageResponseMessage.UPLOAD_ERROR; | ||
|
||
public class UploadException extends ImageException{ | ||
public UploadException() { | ||
super(UPLOAD_ERROR.getMessage(), IMAGE_UPLOAD_ERROR.getCode()); | ||
} | ||
} |
34 changes: 26 additions & 8 deletions
34
src/main/java/com/postgraduate/domain/image/presentation/ImageController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,56 @@ | ||
package com.postgraduate.domain.image.presentation; | ||
|
||
import com.postgraduate.domain.image.application.dto.PreSignedUrlRequest; | ||
import com.postgraduate.domain.image.application.dto.PreSignedUrlResponse; | ||
import com.postgraduate.domain.image.application.dto.req.PreSignedUrlRequest; | ||
import com.postgraduate.domain.image.application.dto.res.PreSignedUrlResponse; | ||
import com.postgraduate.domain.image.application.dto.res.ImageUrlResponse; | ||
import com.postgraduate.domain.image.application.usecase.ImageUploadUseCase; | ||
import com.postgraduate.domain.image.application.usecase.PreSignedUseCase; | ||
import com.postgraduate.domain.user.domain.entity.User; | ||
import com.postgraduate.global.dto.ResponseDto; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import org.springframework.security.core.annotation.AuthenticationPrincipal; | ||
import org.springframework.web.bind.annotation.*; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import static com.postgraduate.domain.image.presentation.constant.ImageResponseCode.IMAGE_CREATE; | ||
import static com.postgraduate.domain.image.presentation.constant.ImageResponseMessage.ISSUE_URL; | ||
import static com.postgraduate.domain.image.presentation.constant.ImageResponseMessage.UPLOAD_URL; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/image") | ||
@Tag(name = "IMAGE Controller") | ||
public class ImageController { | ||
private final PreSignedUseCase preSignedUseCase; | ||
private final ImageUploadUseCase imageUploadUseCase; | ||
|
||
@PostMapping("/url/profile") | ||
@Operation(description = "USER Profile 등록 URL API - 이미지 풀네임으로 주세요 xxx.확장자, 이미지 이름을 유니크하게 만들어주세요 UUID+파일명 등등") | ||
public ResponseDto<PreSignedUrlResponse> getProfileUrl(@RequestBody PreSignedUrlRequest preSignedUrlRequest) { | ||
public ResponseDto<PreSignedUrlResponse> getProfilePreSignedUrl(@RequestBody PreSignedUrlRequest preSignedUrlRequest) { | ||
PreSignedUrlResponse profileUrl = preSignedUseCase.getProfileUrl(preSignedUrlRequest); | ||
return ResponseDto.create(IMAGE_CREATE.getCode(), ISSUE_URL.getMessage(), profileUrl); | ||
} | ||
|
||
@PostMapping("/url/certification") | ||
@Operation(description = "Senior 학생증 인증 등록 URL API - 이미지 풀네임으로 주세요 xxx.확장자, 이미지 이름을 유니크하게 만들어주세요 UUID+파일명 등등") | ||
public ResponseDto<PreSignedUrlResponse> getCertificationUrl(@RequestBody PreSignedUrlRequest preSignedUrlRequest) { | ||
public ResponseDto<PreSignedUrlResponse> getCertificationPreSignedUrl(@RequestBody PreSignedUrlRequest preSignedUrlRequest) { | ||
PreSignedUrlResponse certificationUrl = preSignedUseCase.getCertificationUrl(preSignedUrlRequest); | ||
return ResponseDto.create(IMAGE_CREATE.getCode(), ISSUE_URL.getMessage(), certificationUrl); | ||
} | ||
|
||
@PostMapping("/upload/profile") | ||
@Operation(summary = "USER Profile 업로드 후 업로드 URL return / 토큰 필요", description = "profileFile 사진 Multipart File로 보내주세요") | ||
public ResponseDto<ImageUrlResponse> getProfileUrl(@AuthenticationPrincipal User user, @RequestPart MultipartFile profileFile) { | ||
ImageUrlResponse imageUrlResponse = imageUploadUseCase.uploadProfile(user, profileFile); | ||
return ResponseDto.create(IMAGE_CREATE.getCode(), UPLOAD_URL.getMessage(), imageUrlResponse); | ||
} | ||
|
||
@PostMapping("/upload/certification") | ||
@Operation(summary = "SENIOR Certification 업로드 후 업로드 URL return", description = "certificationFile 사진 Multipart File로 보내주세요") | ||
public ResponseDto<ImageUrlResponse> getCertificationUrl(@RequestPart MultipartFile certificationFile) { | ||
ImageUrlResponse imageUrlResponse = imageUploadUseCase.uploadCertification(certificationFile); | ||
return ResponseDto.create(IMAGE_CREATE.getCode(), UPLOAD_URL.getMessage(), imageUrlResponse); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 5 additions & 13 deletions
18
...a/com/postgraduate/domain/senior/application/dto/res/SeniorMyPageUserAccountResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,8 @@ | ||
package com.postgraduate.domain.senior.application.dto.res; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Builder | ||
@Getter | ||
@AllArgsConstructor | ||
public class SeniorMyPageUserAccountResponse { | ||
private final String profile; | ||
private final String nickName; | ||
private final String bank; | ||
private final String accountNumber; | ||
private final String accountHolder; | ||
public record SeniorMyPageUserAccountResponse(String profile, String phoneNumber, String nickName, String bank, String accountNumber, | ||
String accountHolder) { | ||
public SeniorMyPageUserAccountResponse(String profile, String phoneNumber, String nickName) { | ||
this(profile, phoneNumber, nickName, null, null, null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.