Skip to content

Commit 3570b8d

Browse files
authored
feat: 파일 업로드 엔티티 매핑 설정 및 운영환경 Graceful ShutDown 추가
* Feat: 운영환경 추가 설정 - mulipart로 파일 업로드 시, 최대 허용 크기 설정 - Graceful Shutdown 적용 * Fix: 파일 업로드 EntityType 수정 기존 : POST, PROFILE, AVATAR 변경 : POST, PROFILE, STUDY_ROOM * Feat: AttachmentMappingRepository 메서드 추가 - deleteAllByEntityTypeAndEntityId (EntityType과 EnityId에 해당하는 파일 매핑 정보 모두 삭제) * Fix: AttachmentMappingRepository 메서드 수정 - findByEntityTypeAndEntityId -> findAllByEntityTypeAndEntityId
1 parent 4a86607 commit 3570b8d

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package com.back.domain.file.entity;
22

33
public enum EntityType {
4-
POST, AVATAR, PROFILE
4+
POST, PROFILE, STUDY_ROOM
55
}

src/main/java/com/back/domain/file/repository/AttachmentMappingRepository.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
import com.back.domain.file.entity.EntityType;
55
import org.springframework.data.jpa.repository.JpaRepository;
66

7+
import java.util.List;
78
import java.util.Optional;
89

910
public interface AttachmentMappingRepository extends JpaRepository<AttachmentMapping, Long> {
10-
Optional<AttachmentMapping> findByEntityTypeAndEntityId(EntityType entityType, Long entityID);
11-
}
11+
List<AttachmentMapping> findAllByEntityTypeAndEntityId(EntityType entityType, Long entityId);
12+
13+
void deleteAllByEntityTypeAndEntityId(EntityType entityType, Long entityId);
14+
}

src/main/resources/application-prod.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ spring:
7474
user-info-uri: https://api.github.com/user
7575
user-name-attribute: id
7676

77+
servlet:
78+
multipart:
79+
max-file-size: 10MB # 업로드할 수 있는 개별 파일의 최대 크기
80+
max-request-size: 10MB # 한 요청의 최대 허용 크기
81+
7782
mail:
7883
host: ${EMAIL_HOST} # Gmail SMTP 서버 (운영 환경에서는 AWS SES 등으로 변경 권장)
7984
port: ${EMAIL_PORT}
@@ -86,6 +91,12 @@ spring:
8691
starttls:
8792
enable: true
8893

94+
lifecycle:
95+
timeout-per-shutdown-phase: 30s # 종료 대기 시간
96+
97+
server:
98+
shutdown: graceful # graceful shutdown 활성화
99+
89100
springdoc:
90101
default-produces-media-type: application/json;charset=UTF-8
91102

0 commit comments

Comments
 (0)