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
2 changes: 1 addition & 1 deletion backend/frazzle/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ out/
### VS Code ###
.vscode/

application-*.properties
application-*.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ public class Piece {
@JoinColumn(name = "user_id")
private User user;

@Version
@Column(name = "version")
private Integer version;

@UpdateTimestamp
@Column(name = "modified_at", columnDefinition = "TIMESTAMP")
private LocalDateTime modifiedAt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public enum ErrorCode {
IMAGE_NOT_FOUND("이미지가 존재하지 않습니다.", HttpStatus.NOT_FOUND),
VOTE_NOT_FOUND("투표가 비활성화 되었습니다.", HttpStatus.NOT_FOUND),
NOTIFICATION_NOT_FOUND("존재하지 않는 초대 요청입니다.", HttpStatus.NOT_FOUND),
NOT_COMPLETE_GAME("게임을 클리어하지 않았습니다.", HttpStatus.NOT_FOUND)
NOT_COMPLETE_GAME("게임을 클리어하지 않았습니다.", HttpStatus.NOT_FOUND),
CONCURRENT_UPDATE_PIECE("다른 사용자가 먼저 퍼즐 조각을 업로드하였습니다.", HttpStatus.CONFLICT)
;

private final String message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.ObjectOptimisticLockingFailureException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

Expand All @@ -25,6 +26,18 @@ public ResponseEntity<ResultDto<Object>> handleCustomException(CustomException e
return new ResponseEntity<>(response, ex.getErrorCode().getHttpStatus());
}

@ExceptionHandler(ObjectOptimisticLockingFailureException.class)
public ResponseEntity<ResultDto<Object>> handleOptimisticLockingException(Exception ex) {
logger.error("[OptimisticException] message: " + ex.getMessage());

ResultDto<Object> response = ResultDto.res(
ErrorCode.CONCURRENT_UPDATE_PIECE.getHttpStatus().value(),
ErrorCode.CONCURRENT_UPDATE_PIECE.getMessage()
);

return new ResponseEntity<>(response, HttpStatus.CONFLICT);
}

@ExceptionHandler(RuntimeException.class)
public ResponseEntity<ResultDto<Object>> handleRuntimeException(RuntimeException ex) {
logger.error("[RuntimeException] message: " + ex.getMessage());
Expand Down
25 changes: 0 additions & 25 deletions backend/frazzle/src/main/resources/application.properties

This file was deleted.

38 changes: 38 additions & 0 deletions backend/frazzle/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
spring:
application:
name: frazzle

servlet:
context-path: /api/v1
multipart:
enabled: true
max-file-size: 10MB
max-request-size: 10MB

profiles:
include: secret

jpa:
hibernate:
ddl-auto: update
show-sql: true
properties:
hibernate:
dialect: org.hibernate.dialect.MySQL8Dialect
format_sql: true
jdbc:
batch_size: 20

datasource:
hikari:
connection-timeout: 30000
maximum-pool-size: 10
minimum-idle: 5
idle-timeout: 600000
max-lifetime: 1800000

springdoc:
api-docs:
path: /v3/api-docs
swagger-ui:
path: /swagger-ui.html