-
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.
RAC-100 feat : 프로필 사진 등록 및 멘토 회원가입
- Loading branch information
Showing
28 changed files
with
350 additions
and
101 deletions.
There are no files selected for viewing
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
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
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
12 changes: 12 additions & 0 deletions
12
src/main/java/com/postgraduate/domain/image/application/dto/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.postgraduate.domain.image.application.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class PreSignedUrlRequest { | ||
private String fileName; | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/com/postgraduate/domain/image/application/dto/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.postgraduate.domain.image.application.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Builder | ||
@Getter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class PreSignedUrlResponse { | ||
private String preSignedUrl; | ||
} |
27 changes: 27 additions & 0 deletions
27
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.postgraduate.domain.image.application.usecase; | ||
|
||
import com.postgraduate.domain.image.application.dto.PreSignedUrlRequest; | ||
import com.postgraduate.domain.image.application.dto.PreSignedUrlResponse; | ||
import com.postgraduate.global.config.s3.S3Service; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class PreSignedUseCase { | ||
private final S3Service s3Service; | ||
|
||
public PreSignedUrlResponse getProfileUrl(PreSignedUrlRequest preSignedUrlRequest) { | ||
if (preSignedUrlRequest.getFileName().isEmpty()) | ||
throw new IllegalArgumentException(); //TODO : 빈값이 들어올 경우 예외 처리 | ||
String preSignedUrl = s3Service.getProfilePreSignedUrl(preSignedUrlRequest.getFileName()); | ||
return new PreSignedUrlResponse(preSignedUrl); | ||
} | ||
|
||
public PreSignedUrlResponse getCertificationUrl(PreSignedUrlRequest preSignedUrlRequest) { | ||
if (preSignedUrlRequest.getFileName().isEmpty()) | ||
throw new IllegalArgumentException(); //TODO : 빈값이 들어올 경우 예외 처리 | ||
String preSignedUrl = s3Service.getCertificationPreSignedUrl(preSignedUrlRequest.getFileName()); | ||
return new PreSignedUrlResponse(preSignedUrl); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
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.usecase.PreSignedUseCase; | ||
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 static com.postgraduate.domain.image.presentation.constant.ImageResponseCode.IMAGE_CREATE; | ||
import static com.postgraduate.domain.image.presentation.constant.ImageResponseMessage.ISSUE_URL; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/image") | ||
@Tag(name = "IMAGE Controller") | ||
public class ImageController { | ||
private final PreSignedUseCase preSignedUseCase; | ||
|
||
@PostMapping("/url/profile") | ||
@Operation(description = "USER Profile 등록 URL API - 이미지 풀네임으로 주세요 xxx.확장자, 이미지 이름을 유니크하게 만들어주세요 UUID+파일명 등등") | ||
public ResponseDto<PreSignedUrlResponse> getProfileUrl(@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) { | ||
PreSignedUrlResponse certificationUrl = preSignedUseCase.getCertificationUrl(preSignedUrlRequest); | ||
return ResponseDto.create(IMAGE_CREATE.getCode(), ISSUE_URL.getMessage(), certificationUrl); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/com/postgraduate/domain/image/presentation/constant/ImageResponseCode.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,14 @@ | ||
package com.postgraduate.domain.image.presentation.constant; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum ImageResponseCode { | ||
IMAGE_FIND("IMG200"), | ||
IMAGE_UPDATE("IMG201"), | ||
IMAGE_CREATE("IMG202"), | ||
IMAGE_DELETE("IMG203"); | ||
private final String code; | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/com/postgraduate/domain/image/presentation/constant/ImageResponseMessage.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,11 @@ | ||
package com.postgraduate.domain.image.presentation.constant; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum ImageResponseMessage { | ||
ISSUE_URL("URL발급에 성공하였습니다."); | ||
private final String message; | ||
} |
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
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
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
15 changes: 15 additions & 0 deletions
15
src/main/java/com/postgraduate/domain/senior/domain/service/SeniorUpdateService.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,15 @@ | ||
package com.postgraduate.domain.senior.domain.service; | ||
|
||
import com.postgraduate.domain.senior.application.dto.req.SeniorProfileRequest; | ||
import com.postgraduate.domain.senior.domain.entity.Senior; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
@RequiredArgsConstructor | ||
@Service | ||
public class SeniorUpdateService { | ||
|
||
public void updateSeniorProfile(Senior senior, SeniorProfileRequest profileRequest) { | ||
senior.updateProfile(profileRequest); | ||
} | ||
} |
Oops, something went wrong.