From 63999f4b0316f18fcd8368aadf1307f43cda13b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B0=AC=EA=B8=B0?= Date: Wed, 1 Jan 2025 12:06:55 +0900 Subject: [PATCH 1/2] fix: getting s3 origin link file key --- .../java/sopt/org/homepage/aws/s3/S3ServiceImpl.java | 12 ++++++++---- .../org/homepage/main/service/MainServiceImpl.java | 3 ++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/java/sopt/org/homepage/aws/s3/S3ServiceImpl.java b/src/main/java/sopt/org/homepage/aws/s3/S3ServiceImpl.java index 8677f71..0489e7e 100644 --- a/src/main/java/sopt/org/homepage/aws/s3/S3ServiceImpl.java +++ b/src/main/java/sopt/org/homepage/aws/s3/S3ServiceImpl.java @@ -11,6 +11,7 @@ import software.amazon.awssdk.services.s3.model.GetUrlRequest; import software.amazon.awssdk.services.s3.model.PutObjectRequest; import software.amazon.awssdk.services.s3.presigner.S3Presigner; +import software.amazon.awssdk.services.s3.presigner.model.GetObjectPresignRequest; import software.amazon.awssdk.services.s3.presigner.model.PresignedPutObjectRequest; import software.amazon.awssdk.services.s3.presigner.model.PutObjectPresignRequest; @@ -94,12 +95,15 @@ public String uploadFile(MultipartFile file, String path) { public String getFileUrl(String fileName) { try { - GetUrlRequest request = GetUrlRequest.builder() - .bucket(bucket) - .key(fileName) + GetObjectPresignRequest request = GetObjectPresignRequest.builder() + .signatureDuration(Duration.ofMinutes(10)) + .getObjectRequest(b -> b + .bucket(bucket) + .key(fileName) + .build()) .build(); - return s3Client.utilities().getUrl(request).toString(); + return s3Presigner.presignGetObject(request).url().toString(); } catch (Exception e) { log.error("Error getting file URL: {}", fileName, e); throw new RuntimeException("Failed to get file URL", e); diff --git a/src/main/java/sopt/org/homepage/main/service/MainServiceImpl.java b/src/main/java/sopt/org/homepage/main/service/MainServiceImpl.java index 40daf5c..9b1b870 100644 --- a/src/main/java/sopt/org/homepage/main/service/MainServiceImpl.java +++ b/src/main/java/sopt/org/homepage/main/service/MainServiceImpl.java @@ -36,6 +36,7 @@ import sopt.org.homepage.admin.dto.response.main.recruit.schedule.GetAdminRecruitScheduleResponseRecordDto; import sopt.org.homepage.admin.dto.response.main.recruit.schedule.GetAdminScheduleResponseRecordDto; import sopt.org.homepage.admin.dto.response.news.GetAdminNewsResponseDto; +import sopt.org.homepage.aws.s3.S3Service; import sopt.org.homepage.aws.s3.S3ServiceImpl; import sopt.org.homepage.cache.CacheService; import sopt.org.homepage.common.constants.CacheType; @@ -73,7 +74,7 @@ public class MainServiceImpl implements MainService { private final MainRepository mainRepository; private final MainNewsRepository mainNewsRepository; - private final S3ServiceImpl s3Service; + private final S3Service s3Service; private final CacheService cacheService; public AddAdminResponseDto adminAddMainData(AddAdminRequestDto addAdminRequestDto) { From f23f0269fbc9785006f615347c1ef7ea290ab0b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B0=AC=EA=B8=B0?= Date: Wed, 1 Jan 2025 12:28:05 +0900 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=EB=A9=94=EC=9D=B8=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=EC=A7=80=EC=9B=90=20=EC=9D=BC=EC=A0=95=20?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=20=EC=B6=94=EA=B0=80=20&=20About=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=EC=A7=80=EB=82=9C=20=EA=B8=B0=EC=88=98=20?= =?UTF-8?q?=ED=99=9C=EB=8F=99=20=EB=A0=88=EC=BD=94=EB=93=9C=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/GetAboutPageResponseDto.java | 3 +++ .../dto/response/GetMainPageResponseDto.java | 2 ++ .../homepage/main/service/MainServiceImpl.java | 17 +++++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/src/main/java/sopt/org/homepage/main/dto/response/GetAboutPageResponseDto.java b/src/main/java/sopt/org/homepage/main/dto/response/GetAboutPageResponseDto.java index aecace8..0d0b2f6 100644 --- a/src/main/java/sopt/org/homepage/main/dto/response/GetAboutPageResponseDto.java +++ b/src/main/java/sopt/org/homepage/main/dto/response/GetAboutPageResponseDto.java @@ -6,6 +6,7 @@ import lombok.Getter; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; +import sopt.org.homepage.aboutsopt.dto.GetAboutSoptResponseDto; import sopt.org.homepage.main.dto.response.main.branding.GetMainBrandingColorResponseRecordDto; import sopt.org.homepage.main.dto.response.main.core.GetMainCoreValueResponseRecordDto; import sopt.org.homepage.main.dto.response.main.curriculum.GetMainPartCurriculumResponseRecordDto; @@ -33,6 +34,8 @@ public class GetAboutPageResponseDto { private List coreValue; private List partCurriculum; private List member; + + private GetAboutSoptResponseDto.ActivitiesRecords activitiesRecords; } diff --git a/src/main/java/sopt/org/homepage/main/dto/response/GetMainPageResponseDto.java b/src/main/java/sopt/org/homepage/main/dto/response/GetMainPageResponseDto.java index 11ab1fc..1c24040 100644 --- a/src/main/java/sopt/org/homepage/main/dto/response/GetMainPageResponseDto.java +++ b/src/main/java/sopt/org/homepage/main/dto/response/GetMainPageResponseDto.java @@ -10,6 +10,7 @@ import sopt.org.homepage.main.dto.response.main.button.GetMainMainButtonResponseRecordDto; import sopt.org.homepage.main.dto.response.main.introduction.GetMainPartIntroductionResponseRecordDto; import sopt.org.homepage.main.dto.response.main.news.GetMainLatestNewsResponseRecordDto; +import sopt.org.homepage.main.dto.response.main.recruit.schedule.GetMainRecruitScheduleResponseRecordDto; import java.util.List; @@ -30,6 +31,7 @@ public class GetMainPageResponseDto { private GetMainMainButtonResponseRecordDto mainButton; private List partIntroduction; private List latestNews; + private List recruitSchedule; } diff --git a/src/main/java/sopt/org/homepage/main/service/MainServiceImpl.java b/src/main/java/sopt/org/homepage/main/service/MainServiceImpl.java index 9b1b870..b30420a 100644 --- a/src/main/java/sopt/org/homepage/main/service/MainServiceImpl.java +++ b/src/main/java/sopt/org/homepage/main/service/MainServiceImpl.java @@ -4,6 +4,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import sopt.org.homepage.aboutsopt.AboutSoptService; import sopt.org.homepage.admin.dto.request.main.AddAdminConfirmRequestDto; import sopt.org.homepage.admin.dto.request.main.AddAdminRequestDto; import sopt.org.homepage.admin.dto.request.main.GetAdminRequestDto; @@ -77,6 +78,8 @@ public class MainServiceImpl implements MainService { private final S3Service s3Service; private final CacheService cacheService; + private final AboutSoptService aboutSoptService; + public AddAdminResponseDto adminAddMainData(AddAdminRequestDto addAdminRequestDto) { String baseDir = addAdminRequestDto.getGeneration() + "/"; @@ -349,6 +352,19 @@ public GetMainPageResponseDto getMainPageData() { .build()) .toList() ) + .recruitSchedule(mainEntity.getRecruitSchedule().stream().map(schedule -> GetMainRecruitScheduleResponseRecordDto.builder() + .type(schedule.getType()) + .schedule(GetMainScheduleResponseRecordDto.builder() + .applicationStartTime(schedule.getSchedule().getApplicationStartTime()) + .applicationEndTime(schedule.getSchedule().getApplicationEndTime()) + .applicationResultTime(schedule.getSchedule().getApplicationResultTime()) + .interviewStartTime(schedule.getSchedule().getInterviewStartTime()) + .interviewEndTime(schedule.getSchedule().getInterviewEndTime()) + .finalResultTime(schedule.getSchedule().getFinalResultTime()) + .build()) + .build()) + .toList() + ) .build(); } @@ -394,6 +410,7 @@ public GetAboutPageResponseDto getAboutPageData() { .build()) .toList() ) + .activitiesRecords(aboutSoptService.getAboutSopt(mainEntity.getGeneration()).activitiesRecords()) .build(); }