Skip to content

Commit

Permalink
Merge pull request #18 from sopt-makers/feat/#5-officialpage-admin
Browse files Browse the repository at this point in the history
[Refac]: 어드민 프론트 QA 요청사항 반영
  • Loading branch information
Lim-Changi authored Jan 3, 2025
2 parents cfd465e + 5acdc7f commit c44379a
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 5 deletions.
12 changes: 8 additions & 4 deletions src/main/java/sopt/org/homepage/aws/s3/S3ServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -33,6 +34,8 @@ public class GetAboutPageResponseDto {
private List<GetMainCoreValueResponseRecordDto> coreValue;
private List<GetMainPartCurriculumResponseRecordDto> partCurriculum;
private List<GetMainMemberResponseRecordDto> member;

private GetAboutSoptResponseDto.ActivitiesRecords activitiesRecords;
}


Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -30,6 +31,7 @@ public class GetMainPageResponseDto {
private GetMainMainButtonResponseRecordDto mainButton;
private List<GetMainPartIntroductionResponseRecordDto> partIntroduction;
private List<GetMainLatestNewsResponseRecordDto> latestNews;
private List<GetMainRecruitScheduleResponseRecordDto> recruitSchedule;
}


Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -36,6 +37,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;
Expand Down Expand Up @@ -73,9 +75,11 @@ 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;

private final AboutSoptService aboutSoptService;

public AddAdminResponseDto adminAddMainData(AddAdminRequestDto addAdminRequestDto) {
String baseDir = addAdminRequestDto.getGeneration() + "/";

Expand Down Expand Up @@ -348,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();
}

Expand Down Expand Up @@ -393,6 +410,7 @@ public GetAboutPageResponseDto getAboutPageData() {
.build())
.toList()
)
.activitiesRecords(aboutSoptService.getAboutSopt(mainEntity.getGeneration()).activitiesRecords())
.build();
}

Expand Down

0 comments on commit c44379a

Please sign in to comment.