Skip to content

Commit

Permalink
add: package hierarchy 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
yj0111 committed Jan 4, 2025
1 parent fb19b34 commit d35de80
Show file tree
Hide file tree
Showing 25 changed files with 213 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package TiCatch.backend.domain.history.controller;

public class HistoryController {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package TiCatch.backend.domain.history.dto.request;

public class RequestDto {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package TiCatch.backend.domain.history.dto.response;

public class ResponseDto {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package TiCatch.backend.domain.history.repository;

public interface HistoryRepository {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package TiCatch.backend.domain.history.service;

public interface HistoryService {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package TiCatch.backend.domain.history.service;

public class HistoryServiceImpl {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package TiCatch.backend.domain.member.controller;

public class MemberController {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package TiCatch.backend.domain.member.dto.request;

public class RequestDto {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package TiCatch.backend.domain.member.dto.response;

public class ResponseDto {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package TiCatch.backend.domain.member.repository;

public interface MemberRepository {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package TiCatch.backend.domain.member.service;

public interface MemberService {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package TiCatch.backend.domain.member.service;

public class MemberServiceImpl {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package TiCatch.backend.domain.ticketing.controller;

public class TicketingController {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package TiCatch.backend.domain.ticketing.dto.request;

public class RequestDto {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package TiCatch.backend.domain.ticketing.dto.response;

public class ResponseDto {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package TiCatch.backend.domain.ticketing.repository;

public interface TicketingRepository {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package TiCatch.backend.domain.ticketing.service;

public interface TicketingService {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package TiCatch.backend.domain.ticketing.service;

public class TicketingServiceImpl {
}
13 changes: 13 additions & 0 deletions src/main/java/TiCatch/backend/global/exception/ExceptionCode.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package TiCatch.backend.global.exception;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum ExceptionCode {

SERVER_EXCEPTION(500, "서버에서 예측하지 못한 에러가 발생했습니다.");
private final int errorCode;
private final String errorMessage;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package TiCatch.backend.global.exception;

import TiCatch.backend.global.response.ResponseResult;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Slf4j
@RequiredArgsConstructor
@RestControllerAdvice(basePackages = "TiCatch.backend")
public class ExceptionController {
@ExceptionHandler(ServerException.class)
public ResponseResult ServerException(ServerException err) {
log.info("Error : {}", err.getClass());
log.info("Error Message : {}", err.getMessage());
return ResponseResult.exceptionResponse(ExceptionCode.SERVER_EXCEPTION, err.getMessage());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package TiCatch.backend.global.exception;

public class ServerException extends RuntimeException{
public ServerException() {
super(ExceptionCode.SERVER_EXCEPTION.getErrorMessage());
}
public ServerException(String message) {
super(message);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package TiCatch.backend.global.response;

import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.List;

@Getter
@NoArgsConstructor
public class ListResponseResult<T> extends ResponseResult {

private List<T> data;

public ListResponseResult(List<T> data) {
super(successResponse.statusCode, successResponse.messages, successResponse.developerMessage,
successResponse.timestamp);
this.data = data;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package TiCatch.backend.global.response;


import lombok.Getter;
import lombok.NoArgsConstructor;
import org.springframework.data.domain.Page;

@Getter
@NoArgsConstructor
public class PageResponseResult<T> extends ResponseResult {

private Page<T> data;

public PageResponseResult(Page<T> data) {
super(successResponse.statusCode, successResponse.messages, successResponse.developerMessage,
successResponse.timestamp);
this.data = data;
}
}
44 changes: 44 additions & 0 deletions src/main/java/TiCatch/backend/global/response/ResponseResult.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package TiCatch.backend.global.response;

import TiCatch.backend.global.exception.ExceptionCode;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.springframework.http.HttpStatus;

import java.time.LocalDateTime;

@Getter
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
public class ResponseResult {

int statusCode;
String messages;
String developerMessage;
LocalDateTime timestamp;

public static final ResponseResult successResponse =
ResponseResult.builder()
.statusCode(HttpStatus.OK.value())
.messages("성공 :)")
.developerMessage("성공하였습니다.")
.timestamp(LocalDateTime.now()).build();

public static final ResponseResult failResponse =
ResponseResult.builder()
.statusCode(HttpStatus.BAD_REQUEST.value())
.messages("실패 :(")
.developerMessage("실패하였습니다.")
.timestamp(LocalDateTime.now()).build();

public static final ResponseResult exceptionResponse(ExceptionCode exceptionCode, String message) {
return ResponseResult.builder()
.statusCode(exceptionCode.getErrorCode())
.messages(message)
.developerMessage(exceptionCode.getErrorMessage())
.timestamp(LocalDateTime.now()).build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package TiCatch.backend.global.response;

import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor
public class SingleResponseResult<T> extends ResponseResult {

private T data;

public SingleResponseResult(T data) {
super(successResponse.statusCode, successResponse.messages, successResponse.developerMessage,
successResponse.timestamp);
this.data = data;
}
}

0 comments on commit d35de80

Please sign in to comment.