From 1e00a471787fa24508a3aedce110ff758b44750e Mon Sep 17 00:00:00 2001 From: minjoon-98 <4kmj54321@gmail.com> Date: Tue, 9 Jul 2024 01:35:06 +0900 Subject: [PATCH 1/2] feat : face challenge --- build.gradle | 7 +- .../controller/ChallengeController.java | 111 ++++++++++++++--- .../namanmoo/controller/FileController.java | 2 +- .../namanmoo/controller/MemberController.java | 3 +- .../namanmoo/dto/family/FamilyInviteDto.java | 0 .../namanmoo/service/AwsS3Service.java | 26 ++-- .../namanmoo/service/ChallengeService.java | 4 +- .../namanmoo/service/DataInitService.java | 95 --------------- .../namanmoo/service/MemberServiceImpl.java | 3 +- .../namanmoo/service/TestDataInit.java | 112 ------------------ src/main/resources/application.yml | 21 ++-- 11 files changed, 135 insertions(+), 249 deletions(-) delete mode 100644 src/main/java/ongjong/namanmoo/dto/family/FamilyInviteDto.java delete mode 100644 src/main/java/ongjong/namanmoo/service/DataInitService.java delete mode 100644 src/main/java/ongjong/namanmoo/service/TestDataInit.java diff --git a/build.gradle b/build.gradle index 040d16b..395bc51 100644 --- a/build.gradle +++ b/build.gradle @@ -18,6 +18,7 @@ repositories { } dependencies { + // Spring Boot dependencies implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-validation' @@ -39,6 +40,7 @@ dependencies { runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5' runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.5' + // Other dependencies runtimeOnly 'com.mysql:mysql-connector-j' implementation 'commons-codec:commons-codec:1.13' @@ -48,8 +50,11 @@ dependencies { // AWS SDK dependencies using BOM implementation platform('com.amazonaws:aws-java-sdk-bom:1.12.529') implementation 'com.amazonaws:aws-java-sdk-s3' -// implementation 'org.springframework.cloud:spring-cloud-starter-aws:2.2.6.RELEASE' implementation 'io.awspring.cloud:spring-cloud-starter-aws:2.4.4' +// implementation 'org.springframework.cloud:spring-cloud-starter-aws:2.2.6.RELEASE' + + // Jackson for JSON processing + implementation 'com.fasterxml.jackson.jr:jackson-jr-all:2.15.2' } tasks.named('test') { diff --git a/src/main/java/ongjong/namanmoo/controller/ChallengeController.java b/src/main/java/ongjong/namanmoo/controller/ChallengeController.java index d65da69..7c8099f 100644 --- a/src/main/java/ongjong/namanmoo/controller/ChallengeController.java +++ b/src/main/java/ongjong/namanmoo/controller/ChallengeController.java @@ -1,8 +1,11 @@ package ongjong.namanmoo.controller; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; import lombok.Data; import lombok.RequiredArgsConstructor; +import ongjong.namanmoo.DateUtil; import ongjong.namanmoo.domain.Member; import ongjong.namanmoo.domain.answer.Answer; import ongjong.namanmoo.domain.challenge.Challenge; @@ -35,17 +38,18 @@ public class ChallengeController { private final AnswerService answerService; private final FamilyService familyService; private final AnswerRepository answerRepository; - - @PostMapping("/") // 챌린지 생성 -> 캐릭터 생성 및 답변 생성 - public ResponseEntity saveChallenge() throws Exception { - Long familyId = familyService.findFamilyId(); - if (!luckyService.join(familyId) || !answerService.createAnswer(familyId)) { - return ResponseEntity.status(HttpStatus.NOT_FOUND) - .body(new ApiResponse("404", "Challenge not found", null)); - } - return ResponseEntity.status(HttpStatus.OK) - .body(new ApiResponse("200", "Success", null)); - } + private final AwsS3Service awsS3Service; + +// @PostMapping("/") // 챌린지 생성 -> 캐릭터 생성 및 답변 생성 +// public ResponseEntity saveChallenge() throws Exception { +// Long familyId = familyService.findFamilyId(); +// if (!luckyService.join(familyId) || !answerService.createAnswer(familyId)) { +// return ResponseEntity.status(HttpStatus.NOT_FOUND) +// .body(new ApiResponse("404", "Challenge not found", null)); +// } +// return ResponseEntity.status(HttpStatus.OK) +// .body(new ApiResponse("200", "Success", null)); +// } @GetMapping("/today") // 오늘의 챌린지 조회 public ResponseEntity getChallenge(@RequestParam("challengeDate") Long challengeDate) throws Exception { @@ -58,7 +62,8 @@ public ResponseEntity getChallenge(@RequestParam("challengeDate") L } Long currentNum = challengeService.findCurrentNum(challengeDate); - ChallengeDto challengeDto = new ChallengeDto(challenge, currentNum ,challengeDate); + DateUtil dateUtil = DateUtil.getInstance(); + ChallengeDto challengeDto = new ChallengeDto(challenge, currentNum, dateUtil.timestampToString(challengeDate)); return ResponseEntity.status(HttpStatus.OK) .body(new ApiResponse("200", "Success", challengeDto)); } @@ -156,7 +161,7 @@ public ResponseEntity>> savePhotoAnswer( } // S3에 파일 업로드 - String uploadImageUrl = AwsS3Service.uploadFile(answerFile); + String uploadImageUrl = awsS3Service.uploadFile(answerFile); // Answer 객체 수정 및 저장 Optional optionalAnswer = answerService.findAnswerByChallengeAndMember(challenge, member); @@ -191,7 +196,6 @@ public ResponseEntity> getFaceChallenge( // 챌린지 번호를 가져옴 (예를 들어, 해당 챌린지의 현재 진행 번호) Long currentNum = challengeService.findCurrentNum(challengeId); - // 챌린지와 멤버를 통해 timestamp를 가져옴 Long timestamp = answerService.findDateByChallengeMember(challenge); @@ -201,6 +205,85 @@ public ResponseEntity> getFaceChallenge( return ResponseEntity.ok(new ApiResponse<>("200", "Success", challengeDto)); } + // 화상 통화 챌린지 결과 저장 + @PostMapping("/face") + public ResponseEntity> saveFaceTimeAnswer( + @RequestParam("challengeId") Long challengeId, + @RequestParam("familyPhotos") MultipartFile[] familyPhotos) throws Exception { + + if (familyPhotos.length != 4) { + return ResponseEntity.status(HttpStatus.BAD_REQUEST) + .body(new ApiResponse<>("400", "Exactly 4 photos must be uploaded", null)); + } + + Challenge challenge = challengeService.findChallengeById(challengeId); + if (challenge == null) { + return ResponseEntity.status(HttpStatus.NOT_FOUND) + .body(new ApiResponse<>("404", "Challenge not found for the provided challengeId", null)); + } + + Member member = memberService.findMemberByLoginId(); + Optional existingAnswer = answerService.findAnswerByChallengeAndMember(challenge, member); + + if (existingAnswer.isEmpty()) { + return ResponseEntity.status(HttpStatus.NOT_FOUND) + .body(new ApiResponse<>("404", "Answer not found for the provided challengeId and member", null)); + } + + // S3에 파일 업로드 및 URL 저장 + List uploadedUrls = new ArrayList<>(); + for (MultipartFile photo : familyPhotos) { + String uploadedUrl = awsS3Service.uploadFile(photo); + uploadedUrls.add(uploadedUrl); + } + + // JSON 형식으로 변환 + ObjectMapper objectMapper = new ObjectMapper(); + String jsonAnswerContent = objectMapper.writeValueAsString(uploadedUrls); + + // Answer 업데이트 + Answer answer = existingAnswer.get(); + answer.setAnswerContent(jsonAnswerContent); + answer.setModifiedDate(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy.MM.dd HH:mm:ss"))); + answerService.saveAnswer(answer); + + return ResponseEntity.ok(new ApiResponse<>("200", "Success", null)); + } + + // 화상 통화 챌린지 결과 조회 + @GetMapping("/face/result") + public ResponseEntity>> getFaceTimeAnswer( + @RequestParam("challengeId") Long challengeId) throws Exception { + + Challenge challenge = challengeService.findChallengeById(challengeId); + if (challenge == null) { + return ResponseEntity.status(HttpStatus.NOT_FOUND) + .body(new ApiResponse<>("404", "Challenge not found for the provided challengeId", null)); + } + + Member member = memberService.findMemberByLoginId(); + Optional existingAnswer = answerService.findAnswerByChallengeAndMember(challenge, member); + + if (existingAnswer.isEmpty()) { + return ResponseEntity.status(HttpStatus.NOT_FOUND) + .body(new ApiResponse<>("404", "Answer not found for the provided challengeId and member", null)); + } + + Answer answer = existingAnswer.get(); + String answerContent = answer.getAnswerContent(); + + // JSON 형식으로 변환된 URL 목록을 Map 형태로 변환 + ObjectMapper objectMapper = new ObjectMapper(); + List familyPhotos = objectMapper.readValue(answerContent, new TypeReference>() {}); + + // 응답 데이터 생성 + Map responseData = new HashMap<>(); + responseData.put("challengeTitle", challenge.getChallengeTitle()); + responseData.put("familyPhotos", familyPhotos); + + return ResponseEntity.ok(new ApiResponse<>("200", "Success", responseData)); + } + @Data static class SaveChallengeRequest { private Long challengeDate; diff --git a/src/main/java/ongjong/namanmoo/controller/FileController.java b/src/main/java/ongjong/namanmoo/controller/FileController.java index c2dfcdc..fa15dd8 100644 --- a/src/main/java/ongjong/namanmoo/controller/FileController.java +++ b/src/main/java/ongjong/namanmoo/controller/FileController.java @@ -16,6 +16,6 @@ public class FileController { @PostMapping("/upload") public String upload(@RequestParam("file") MultipartFile multipartFile) throws IOException { - return AwsS3Service.uploadFile(multipartFile); + return awsS3Service.uploadFile(multipartFile); } } \ No newline at end of file diff --git a/src/main/java/ongjong/namanmoo/controller/MemberController.java b/src/main/java/ongjong/namanmoo/controller/MemberController.java index d03f74b..7071264 100644 --- a/src/main/java/ongjong/namanmoo/controller/MemberController.java +++ b/src/main/java/ongjong/namanmoo/controller/MemberController.java @@ -24,6 +24,7 @@ public class MemberController { private final MemberService memberService; + private final AwsS3Service awsS3Service; // 회원 가입 @PostMapping("/signup") @@ -59,7 +60,7 @@ public ApiResponse updateBasicInfo(@RequestPart("userInfo") Membe // 파일을 전송했을 경우에만 S3 파일 업로드 수행 if (memberUpdateDto.userImg().isPresent() && !memberUpdateDto.userImg().get().isEmpty()) { - uploadImageUrl = AwsS3Service.uploadFile(memberUpdateDto.userImg().get()); + uploadImageUrl = awsS3Service.uploadFile(memberUpdateDto.userImg().get()); } memberService.update(memberUpdateDto); diff --git a/src/main/java/ongjong/namanmoo/dto/family/FamilyInviteDto.java b/src/main/java/ongjong/namanmoo/dto/family/FamilyInviteDto.java deleted file mode 100644 index e69de29..0000000 diff --git a/src/main/java/ongjong/namanmoo/service/AwsS3Service.java b/src/main/java/ongjong/namanmoo/service/AwsS3Service.java index c839965..0082cd2 100644 --- a/src/main/java/ongjong/namanmoo/service/AwsS3Service.java +++ b/src/main/java/ongjong/namanmoo/service/AwsS3Service.java @@ -8,6 +8,7 @@ import com.amazonaws.services.s3.AmazonS3; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; @@ -23,12 +24,13 @@ @Service public class AwsS3Service { - private static AmazonS3 amazonS3Client; + @Autowired + private AmazonS3 amazonS3Client; @Value("${cloud.aws.s3.bucket}") - private static String bucket; + private String bucket; - public static String uploadFile(MultipartFile multipartFile) throws IOException { + public String uploadFile(MultipartFile multipartFile) throws IOException { File uploadFile = convertFile(multipartFile) .orElseThrow(() -> new IllegalArgumentException("MultipartFile -> File convert fail")); @@ -39,7 +41,7 @@ public static String uploadFile(MultipartFile multipartFile) throws IOException return uploadImageUrl; } - private static Optional convertFile(MultipartFile file) throws IOException { + private Optional convertFile(MultipartFile file) throws IOException { String fileName = UUID.randomUUID() + "_" + file.getOriginalFilename(); File convertFile = new File(fileName); @@ -53,11 +55,11 @@ private static Optional convertFile(MultipartFile file) throws IOException return Optional.empty(); } - private static String generateFileName(File uploadFile) { + private String generateFileName(File uploadFile) { return UUID.randomUUID() + "_" + uploadFile.getName(); } - private static String uploadFileToS3(File uploadFile, String fileName) { + private String uploadFileToS3(File uploadFile, String fileName) { amazonS3Client.putObject( new PutObjectRequest(bucket, fileName, uploadFile) .withCannedAcl(CannedAccessControlList.PublicRead) @@ -68,18 +70,20 @@ private static String uploadFileToS3(File uploadFile, String fileName) { return getS3FileURL(fileName); } - private static String getS3FileURL(String fileName) { + private String getS3FileURL(String fileName) { String defaultUrl = "https://s3.amazonaws.com/"; return defaultUrl + bucket + "/" + fileName; } - private static void removeNewFile(File targetFile) { - if (!targetFile.delete()) { - log.error("File delete fail: " + targetFile.getName() + " at path: " + targetFile.getAbsolutePath()); + private void removeNewFile(File targetFile) { + if (targetFile.delete()) { + log.info("File delete success"); + } else { + log.info("File delete fail"); } } - public static void delete(String fileName) { + public void delete(String fileName) { log.info("File Delete : " + fileName); amazonS3Client.deleteObject(bucket, fileName); } diff --git a/src/main/java/ongjong/namanmoo/service/ChallengeService.java b/src/main/java/ongjong/namanmoo/service/ChallengeService.java index 452f0a8..aab22f5 100644 --- a/src/main/java/ongjong/namanmoo/service/ChallengeService.java +++ b/src/main/java/ongjong/namanmoo/service/ChallengeService.java @@ -54,7 +54,7 @@ public Long findCurrentChallengeNum(Long familyId, Long challengeDate) { / for (Lucky lucky : luckies) { if (lucky.isRunning()) { DateUtil dateUtil = DateUtil.getInstance(); - return dateUtil.getDateDifference(lucky.getChallengeStartDate(), dateUtil.getDateStirng(challengeDate)); // 현재 진행되어야할 challenge를 반환 + return dateUtil.getDateDifference(lucky.getChallengeStartDate(), dateUtil.timestampToString(challengeDate)); // 현재 진행되어야할 challenge를 반환 } } return null; @@ -175,7 +175,7 @@ public Long findStartChallengeNum(Long familyId){ // 시작해야하는 chal @Transactional(readOnly = true) public List findRunningChallenges(Long challengeDate) throws Exception { // 현재 진행하고있는 행운이의 챌린지 리스트 30개 가져오기 - Member member = findMemberByLoginId(); // 로그인한 member + Member member = memberService.findMemberByLoginId(); // 로그인한 member Family family = member.getFamily(); return challengeRepository.findByChallengeNumBetween(findStartChallengeNum(family.getFamilyId()), findStartChallengeNum(family.getFamilyId()) + 30); diff --git a/src/main/java/ongjong/namanmoo/service/DataInitService.java b/src/main/java/ongjong/namanmoo/service/DataInitService.java deleted file mode 100644 index a41ab5c..0000000 --- a/src/main/java/ongjong/namanmoo/service/DataInitService.java +++ /dev/null @@ -1,95 +0,0 @@ -//package ongjong.namanmoo.service; -// -//import jakarta.annotation.PostConstruct; -//import lombok.RequiredArgsConstructor; -//import ongjong.namanmoo.domain.Family; -//import ongjong.namanmoo.domain.Lucky; -//import ongjong.namanmoo.domain.Member; -//import ongjong.namanmoo.domain.challenge.NormalC; -//import ongjong.namanmoo.repository.ChallengeRepository; -//import ongjong.namanmoo.repository.FamilyRepository; -//import ongjong.namanmoo.repository.LuckyRepository; -//import ongjong.namanmoo.repository.MemberRepository; -//import org.springframework.stereotype.Service; -//import org.springframework.transaction.annotation.Transactional; -// -//import java.sql.Timestamp; -// -//@Service -//@Transactional -//@RequiredArgsConstructor -//public class DataInitService { -// -// private final FamilyRepository familyRepository; -// private final ChallengeRepository challengeRepository; -// private final MemberRepository memberRepository; -// private final LuckyRepository luckyRepository; -// -// @PostConstruct -// public void init(){ -// Family family1 = new Family(); -// family1.setFamilyName("Test Family 1"); -// family1.setMaxFamilySize(4); -// family1.setCurrentFamilySize(4); -// family1.setInviteCode("testcode1"); -// family1.setChallengeFamilyCount(0L); -// family1.setFamilyOwnerId(1L); -// family1 = familyRepository.save(family1); -// -// Family family2 = new Family(); -// family2.setFamilyName("Test Family 2");x -// family2.setMaxFamilySize(4); -// family2.setCurrentFamilySize(4); -// family2.setInviteCode("testcode2"); -// family2.setChallengeFamilyCount(0L); -// family2.setFamilyOwnerId(1L); -// family2 = familyRepository.save(family2); -// -// // Challenge 생성 및 저장 -// createChallenges(); -// -// // Family 1에 속하는 5명의 멤버 생성 및 저장 -// createMembers(family1); -// -// createLuckyForFamily(family1); -// } -// -// private void createChallenges() { -// String[] challengeDescriptions = { -// "부모님에게 연락하기", -// "가족에게 가장 미안했던 순간은?", -// "가족과 함께 저녁 식사하기", -// "가족과 함께 사진 찍기", -// "가족과 함께 산책하기" -// }; -// -// for (int i = 0; i < challengeDescriptions.length; i++) { -// NormalC challenge = new NormalC(); -// challenge.setChallengeNum((long) (i + 1)); -// challenge.setNormalChallenge(challengeDescriptions[i]); -// challengeRepository.save(challenge); -// } -// } -// -// private void createMembers(Family family) { -// for (int i = 1; i <= 4; i++) { -// Member member = new Member(); -// member.setFamily(family); -// member.setLoginId("member" + i); -// member.setPassword("password" + i); -// member.setName("Member " + i); -// member.setRole("USER"); -// member.setNickname("Nickname " + i); -// member.setMemberImage("image" + i + ".png"); -// memberRepository.save(member); -// } -// } -// private void createLuckyForFamily(Family family) { -// Lucky lucky = new Lucky(); -// lucky.setFamily(family); -// lucky.setStatus(1L); -// lucky.setChallengeStartDate(new Timestamp(System.currentTimeMillis())); -// lucky.setCurrentChallengeNumber(31L); -// luckyRepository.save(lucky); -// } -//} diff --git a/src/main/java/ongjong/namanmoo/service/MemberServiceImpl.java b/src/main/java/ongjong/namanmoo/service/MemberServiceImpl.java index b8fea05..3ed6e03 100644 --- a/src/main/java/ongjong/namanmoo/service/MemberServiceImpl.java +++ b/src/main/java/ongjong/namanmoo/service/MemberServiceImpl.java @@ -23,6 +23,7 @@ public class MemberServiceImpl implements MemberService { private final MemberRepository memberRepository; private final PasswordEncoder passwordEncoder; + private final AwsS3Service awsS3Service; // 회원 가입 진행 @Override @@ -59,7 +60,7 @@ public void update (MemberUpdateDto memberUpdateDto) throws Exception { // 파일을 전송했을 경우에만 S3 파일 업로드 수행 memberUpdateDto.userImg().ifPresent(image -> { try { - String imagePath = AwsS3Service.uploadFile(image); + String imagePath = awsS3Service.uploadFile(image); member.setMemberImage(imagePath); } catch (IOException e) { throw new RuntimeException("S3 업로드 중 에러가 발생했습니다.", e); diff --git a/src/main/java/ongjong/namanmoo/service/TestDataInit.java b/src/main/java/ongjong/namanmoo/service/TestDataInit.java deleted file mode 100644 index 0626567..0000000 --- a/src/main/java/ongjong/namanmoo/service/TestDataInit.java +++ /dev/null @@ -1,112 +0,0 @@ -//package ongjong.namanmoo.service; -// -//import jakarta.annotation.PostConstruct; -//import lombok.RequiredArgsConstructor; -//import ongjong.namanmoo.domain.Family; -//import ongjong.namanmoo.domain.Lucky; -//import ongjong.namanmoo.domain.Member; -//import ongjong.namanmoo.domain.challenge.NormalC; -//import ongjong.namanmoo.repository.ChallengeRepository; -//import ongjong.namanmoo.repository.FamilyRepository; -//import ongjong.namanmoo.repository.LuckyRepository; -//import ongjong.namanmoo.repository.MemberRepository; -//import org.springframework.stereotype.Service; -//import org.springframework.transaction.annotation.Transactional; -// -//import java.sql.Timestamp; -// -//@Service -//@Transactional -//@RequiredArgsConstructor -//public class TestDataInit { -// -// private final MemberRepository memberRepository; -// -// -// Member member = new Member(); -//// member.setFamily(family); -// member.setLoginId("member"); -// member.setPassword("password"); -// member.setName("Member"); -// member.setRole("USER"); -// member.setNickname("Nickname "); -// member.setChallengeMemberCount(0L); -// member.setMemberImage("image" + ".png"); -// memberRepository.save(member); -//} -//// -//// private final FamilyRepository familyRepository; -//// private final ChallengeRepository challengeRepository; -//// private final MemberRepository memberRepository; -//// private final LuckyRepository luckyRepository; -//// -//// @PostConstruct -//// public void init(){ -//// -//// Family family1 = new Family(); -//// family1.setFamilyName("Test Family 1"); -//// family1.setMaxFamilySize(4); -//// family1.setCurrentFamilySize(4); -//// family1.setInviteCode("testcode1"); -//// family1.setChallengeFamilyCount(0L); -//// family1.setFamilyOwnerId(1L); -//// family1 = familyRepository.save(family1); -//// -////// Family family2 = new Family(); -////// family2.setFamilyName("Test Family 2"); -////// family2.setMaxFamilySize(4); -////// family2.setCurrentFamilySize(4); -////// family2.setInviteCode("testcode2"); -////// family2.setChallengeFamilyCount(0L); -////// family2.setFamilyOwnerId(1L); -////// family2 = familyRepository.save(family2); -//// -//// // Challenge 생성 및 저장 -////// createChallenges(); -//// -//// // Family 1에 속하는 5명의 멤버 생성 및 저장 -//// createMembers(family1); -//// -////// createLuckyForFamily(family1); -//// } -//// -////// private void createChallenges() { -////// String[] challengeDescriptions = { -////// "부모님에게 연락하기", -////// "가족에게 가장 미안했던 순간은?", -////// "가족과 함께 저녁 식사하기", -////// "가족과 함께 사진 찍기", -////// "가족과 함께 산책하기" -////// }; -////// -////// for (int i = 0; i < challengeDescriptions.length; i++) { -////// NormalC challenge = new NormalC(); -////// challenge.setChallengeNum((long) (i + 1)); -////// challenge.setNormalChallenge(challengeDescriptions[i]); -////// challengeRepository.save(challenge); -////// } -////// } -//// -//// private void createMembers(Family family) { -//// for (int i = 1; i <= 4; i++) { -//// Member member = new Member(); -//// member.setFamily(family); -//// member.setLoginId("member" + i); -//// member.setPassword("password" + i); -//// member.setName("Member " + i); -//// member.setRole("USER"); -//// member.setNickname("Nickname " + i); -//// member.setChallengeMemberCount(0L); -//// member.setMemberImage("image" + i + ".png"); -//// memberRepository.save(member); -//// } -//// } -////// private void createLuckyForFamily(Family family) { -////// Lucky lucky = new Lucky(); -////// lucky.setFamily(family); -////// lucky.setStatus(1L); -////// lucky.setChallengeStartDate(new Timestamp(System.currentTimeMillis())); -////// lucky.setCurrentChallengeNumber(31L); -////// luckyRepository.save(lucky); -////// } -////} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 62bf27e..ddf0051 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -5,13 +5,21 @@ spring: password: ${SPRING_DATASOURCE_PASSWORD} driver-class-name: com.mysql.cj.jdbc.Driver + servlet: + multipart: + enabled: true # 멀티파트 업로드 지원 여부 (default: true) + file-size-threshold: 0B # 파일을 디스크에 저장하지 않고 메모리에 저장하는 최소 크기 (default: 0B) + location: /users/charming/temp # 업로드된 파일이 임시로 저장되는 디스크 위치 (default: WAS가 결정) + max-file-size: 20MB # 한 개 파일의 최대 사이즈 (default: 1MB) + max-request-size: 20MB # 한 개 요청의 최대 사이즈 (default: 10MB) + profiles: include: jwt # jwt.yml 불러오기 jpa: hibernate: # 애플리케이션 실행 시점에 테이블을 drop하고, 다시 생성 - ddl-auto: create + ddl-auto: update # 계속 유지 # ddl-auto : none properties: @@ -33,13 +41,4 @@ cloud: region: static: ap-northeast-2 stack: - auto: false - - servlet: - servlet: - multipart: - enabled: true # 멀티파트 업로드 지원 여부 (default: true) - file-size-threshold: 0B # 파일을 디스크에 저장하지 않고 메모리에 저장하는 최소 크기 (default: 0B) - location: /users/charming/temp # 업로드된 파일이 임시로 저장되는 디스크 위치 (default: WAS가 결정) - max-file-size: 20MB # 한 개 파일의 최대 사이즈 (default: 1MB) - max-request-size: 20MB # 한 개 요청의 최대 사이즈 (default: 10MB) \ No newline at end of file + auto: false \ No newline at end of file From 698e1e96e7f38376d9bf5dd5c66034a05b0545b5 Mon Sep 17 00:00:00 2001 From: minjoon-98 <4kmj54321@gmail.com> Date: Tue, 9 Jul 2024 10:49:24 +0900 Subject: [PATCH 2/2] fix : Spring Boot CI-CD.yml --- .github/workflows/Spring Boot CI-CD.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Spring Boot CI-CD.yml b/.github/workflows/Spring Boot CI-CD.yml index c06792c..21f12ea 100644 --- a/.github/workflows/Spring Boot CI-CD.yml +++ b/.github/workflows/Spring Boot CI-CD.yml @@ -118,10 +118,10 @@ jobs: -e SPRING_DATASOURCE_USERNAME="${{ secrets.DB_USERNAME }}" \ -e SPRING_DATASOURCE_PASSWORD="${{ secrets.DB_PASSWORD }}" \ -e SECURITY_JWT_TOKEN_SECRET_KEY="${{ secrets.JWT_SECRET_KEY }}" \ - -e AWS_ACCESS_KEY_ID="${{ secrets.S3_ACCESS_KEY_ID }}" \ - -e AWS_SECRET_ACCESS_KEY="${{ secrets.S3_SECRET_ACCESS_KEY }}" \ + -e S3_ACCESS_KEY_ID="${{ secrets.S3_ACCESS_KEY_ID }}" \ + -e S3_SECRET_ACCESS_KEY="${{ secrets.S3_SECRET_ACCESS_KEY }}" \ -e S3_BUCKET_NAME="${{ secrets.S3_BUCKET_NAME }}" \ ${{ env.IMAGE_NAME }} sudo docker ps -a sudo docker system prune -f - set +x + set +x \ No newline at end of file