Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ tasks.named('test') {
useJUnitPlatform()
}

tasks.withType(Test) {
enabled = false
}
//tasks.withType(Test) {
// enabled = false
//}
Empty file modified gradlew
100644 → 100755
Empty file.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.smwu_itple.backend;

import com.smwu_itple.backend.dto.KakaoPayProperties;
import com.smwu_itple.backend.pay.dto.KakaoPayProperties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.smwu_itple.backend.domain;
package com.smwu_itple.backend.archive;

import com.smwu_itple.backend.late.Late;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.smwu_itple.backend.archive;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface ArchiveRepository extends JpaRepository<Archive, Long> {
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.smwu_itple.backend.dto;
package com.smwu_itple.backend.archive.dto;

import lombok.AllArgsConstructor;
import lombok.Getter;
Expand Down

This file was deleted.

23 changes: 23 additions & 0 deletions src/main/java/com/smwu_itple/backend/file/FileService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.smwu_itple.backend.file;

import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;

@Service
@RequiredArgsConstructor
public class FileService {

// private final S3Service s3Service;
//
// // 파일 업로드 (S3 사용)
// public String uploadFile(MultipartFile file) throws IOException {
// return s3Service.uploadFile(file);
// }
//
// // 파일 삭제 (S3 사용)
// public void deleteFile(String fileUrl) {
// s3Service.deleteFile(fileUrl);
// }
}
60 changes: 60 additions & 0 deletions src/main/java/com/smwu_itple/backend/file/S3Service.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
//package com.smwu_itple.backend.file;
//
//import lombok.RequiredArgsConstructor;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.stereotype.Service;
//import org.springframework.web.multipart.MultipartFile;
//import software.amazon.awssdk.core.sync.RequestBody;
//import software.amazon.awssdk.services.s3.S3Client;
//import software.amazon.awssdk.services.s3.model.*;
//
//import java.io.IOException;
//import java.io.InputStream;
//import java.util.UUID;
//
//@Service
//@RequiredArgsConstructor
//public class S3Service {
//
// private final S3Client s3Client;
//
// @Value("${cloud.aws.s3.bucket}")
// private String bucketName;
//
// public String uploadFile(MultipartFile file) throws IOException {
// if (file == null || file.isEmpty()) {
// return null;
// }
//
// String fileName = UUID.randomUUID() + "_" + file.getOriginalFilename();
//
// // S3에 파일 업로드
// PutObjectRequest putObjectRequest = PutObjectRequest.builder()
// .bucket(bucketName)
// .key(fileName)
// .contentType(file.getContentType())
// .contentDisposition("inline")
// .build();
//
// // InputStream을 사용하여 메모리 부담 줄이기
// InputStream inputStream = file.getInputStream();
// s3Client.putObject(putObjectRequest, RequestBody.fromInputStream(inputStream, file.getSize()));
//
// return "https://" + bucketName + ".s3.ap-northeast-2.amazonaws.com/" + fileName;
// }
//
// // S3에서 파일 삭제
// public void deleteFile(String fileUrl) {
// if (fileUrl == null || fileUrl.isEmpty()) {
// return;
// }
// String fileName = fileUrl.substring(fileUrl.lastIndexOf("/") + 1);
//
// DeleteObjectRequest deleteObjectRequest = DeleteObjectRequest.builder()
// .bucket(bucketName)
// .key(fileName)
// .build();
//
// s3Client.deleteObject(deleteObjectRequest);
// }
//}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.smwu_itple.backend.infra.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

@Configuration
public class RestTemplateConfig {

@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
}
}
72 changes: 36 additions & 36 deletions src/main/java/com/smwu_itple/backend/infra/config/S3Config.java
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
package com.smwu_itple.backend.infra.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.s3.S3Client;

@Configuration
public class S3Config {

@Value("${cloud.aws.region.static}")
private String region;

@Value("${cloud.aws.credentials.access-key}")
private String accessKey;

@Value("${cloud.aws.credentials.secret-key}")
private String secretKey;

@Bean
public S3Client s3Client() {
if (accessKey == null || secretKey == null) {
throw new IllegalStateException("AWS 자격증명(access-key, secret-key)이 설정되지 않았습니다.");
}

return S3Client.builder()
.region(Region.of(region))
.credentialsProvider(StaticCredentialsProvider.create(
AwsBasicCredentials.create(accessKey, secretKey)
))
.build();
}
}
//package com.smwu_itple.backend.infra.config;
//
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
//import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
//import software.amazon.awssdk.regions.Region;
//import software.amazon.awssdk.services.s3.S3Client;
//
//@Configuration
//public class S3Config {
//
// @Value("${cloud.aws.region.static}")
// private String region;
//
// @Value("${cloud.aws.credentials.access-key}")
// private String accessKey;
//
// @Value("${cloud.aws.credentials.secret-key}")
// private String secretKey;
//
// @Bean
// public S3Client s3Client() {
// if (accessKey == null || secretKey == null) {
// throw new IllegalStateException("AWS 자격증명(access-key, secret-key)이 설정되지 않았습니다.");
// }
//
// return S3Client.builder()
// .region(Region.of(region))
// .credentialsProvider(StaticCredentialsProvider.create(
// AwsBasicCredentials.create(accessKey, secretKey)
// ))
// .build();
// }
//}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.smwu_itple.backend.infra.exception;

import com.smwu_itple.backend.infra.api.ApiResponse;
import com.smwu_itple.backend.infra.api.FailureStatus;
import org.springframework.web.multipart.MaxUploadSizeExceededException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
Expand Down Expand Up @@ -27,4 +29,9 @@ public ResponseEntity<Map<String, String>> handleMaxSizeException(MaxUploadSizeE
.header("Content-Type", "application/json; charset=UTF-8")
.body(response);
}

@ExceptionHandler(Exception.class)
public ResponseEntity<ApiResponse> handleBusiness(Exception e) {
return ApiResponse.onFailure(null, FailureStatus._BAD_REQUEST, e.getMessage());
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.smwu_itple.backend.domain;
package com.smwu_itple.backend.late;

import com.smwu_itple.backend.archive.Archive;
import com.smwu_itple.backend.owner.Owner;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
package com.smwu_itple.backend.controller;
package com.smwu_itple.backend.late;

import com.smwu_itple.backend.domain.Late;
import com.smwu_itple.backend.dto.ArchiveDto;
import com.smwu_itple.backend.dto.request.LateCreateRequest;
import com.smwu_itple.backend.dto.request.LateSearchRequest;
import com.smwu_itple.backend.dto.request.MessageCreateRequest;
import com.smwu_itple.backend.dto.request.PayCreateRequest;
import com.smwu_itple.backend.dto.response.*;
import com.smwu_itple.backend.archive.dto.ArchiveDto;
import com.smwu_itple.backend.late.dto.LateCreateRequest;
import com.smwu_itple.backend.late.dto.LateCreateResponse;
import com.smwu_itple.backend.late.dto.LateGetResponse;
import com.smwu_itple.backend.late.dto.LateOwnerResponse;
import com.smwu_itple.backend.late.dto.LateSearchRequest;
import com.smwu_itple.backend.message.dto.MessageCreateRequest;
import com.smwu_itple.backend.message.dto.MessageCreateResponse;
import com.smwu_itple.backend.pay.dto.PayCreateRequest;
import com.smwu_itple.backend.pay.dto.PayCreateResponse;
import com.smwu_itple.backend.infra.api.ApiResponse;
import com.smwu_itple.backend.infra.api.FailureStatus;
import com.smwu_itple.backend.infra.api.SuccessStatus;
import com.smwu_itple.backend.infra.exception.UnauthorizedException;
import com.smwu_itple.backend.infra.util.SessionUtil;
import com.smwu_itple.backend.service.LateService;
import com.smwu_itple.backend.service.ManageService;
import jakarta.servlet.http.HttpSession;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
Expand All @@ -23,7 +24,6 @@
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Map;

@Controller
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.smwu_itple.backend.repository;
package com.smwu_itple.backend.late;

import com.smwu_itple.backend.domain.Late;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

Expand Down
Loading