diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..8af972cde --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +/gradlew text eol=lf +*.bat text eol=crlf +*.jar binary diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..c2065bc26 --- /dev/null +++ b/.gitignore @@ -0,0 +1,37 @@ +HELP.md +.gradle +build/ +!gradle/wrapper/gradle-wrapper.jar +!**/src/main/**/build/ +!**/src/test/**/build/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ diff --git a/README.md b/README.md index 5fcc66b4d..c670fd809 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,30 @@ -## [본 과정] 이커머스 핵심 프로세스 구현 -[단기 스킬업 Redis 교육 과정](https://hh-skillup.oopy.io/) 을 통해 상품 조회 및 주문 과정을 구현하며 현업에서 발생하는 문제를 Redis의 핵심 기술을 통해 해결합니다. -> Indexing, Caching을 통한 성능 개선 / 단계별 락 구현을 통한 동시성 이슈 해결 (낙관적/비관적 락, 분산락 등) +## Multi Module Design +Module을 나누는 기준은 여러 개가 있지만, 이번 프로젝트에서는 Layered Architecture 에서 설명되는 Layer 별로 구분하였습니다. +- api: 사용자의 요청을 받고, 응답한다. + - 본래, presentation과 application 두 개의 모듈로 분리되어있던 구조를 수정하였습니다. + - 사용자의 요청을 받고 처리한다는 점에서, Error와 Response를 한 곳에서 관리하기 위함입니다. +- domain: 시스템이 제공할 도메인 규칙을 구현한다. +- infra: 외부 시스템과의 연동을 담당한다. +- 본래 존재하였던 core 모듈을 삭제하였습니다. + - 실제로 공통 역할이 아니지만 core(or common) 모듈에 패키지를 생성해서 정의하는 경우를 방지하기 위함입니다. + - 현재까지의 요구사항에서는 core 모듈에 들어갈 기능이 없다고 판단되었습니다. + +각 module은 하위 module에만 의존합니다.
+JPA 를 다른 ORM 으로 변경될 가능성은 낮다고 판단하여 PA 는 생산성을 위해서 Entity 와 Repository 를 Domain 으로 끌어 올려 사용하였습니다. +JPA 를 제외한 나머지는 저수준의 변경사항으로 부터 고수준을 지키는 방식을 사용합니다. + +## Table Design +![img_2.png](img_2.png) +- Movie 테이블과 Theater 테이블은 N:N 관계로 중간에 Screening 테이블을 두고 있습니다. + - Theater 별로 시간표가 구분되는 것을 고려하여 Screening 테이블은 상영 시간표 정보를 포함하고 있습니다. +- 좌석별 등급 등 좌석 개별의 특성이 추가될 수 있다고 생각하여 Seat 테이블을 생성하였습니다. +- Theater 테이블과 Seat 테이블은 1:N 관계입니다. +- Seat 테이블과 Reservation 테이블은 1:1 관계입니다. + - 공유 자원인 Seat과 행위인 Reservation을 분리하기 위함입니다. +- Reservation 테이블과 User 테이블은 1:1 관계입니다. + +## N+1 문제 해결 +저는 N+1 문제가 ID 참조을 사용하기 때문이라고 생각합니다. 따라서 해당 프로젝트에 간접참조를 사용하여, N+1 문제를 해결하고자 합니다. +뿐만 아니라, 간접 참조를 사용하면 도메인 간 물리적인 연결을 제거하기 때문에 도메인 간 의존을 강제적으로 제거되고, FK의 데이터 정합성을 따지기 위한 성능 오버헤드를 줄이며, 데이터 수정 시의 작업 순서가 강제됨에 따라 발생하는 더 큰 수정 개발을 방지할 수 있습니다. + +대신, 애플리케이션 단에서 무결성 관리를 관리하도록 합니다. (삽입/수정/삭제) \ No newline at end of file diff --git a/api/build.gradle b/api/build.gradle new file mode 100644 index 000000000..de1a5a0bf --- /dev/null +++ b/api/build.gradle @@ -0,0 +1,9 @@ +bootJar.enabled = true + +jar.enabled = false + +dependencies { + implementation project(':domain') + + implementation "org.springframework.boot:spring-boot-starter-web" +} \ No newline at end of file diff --git a/api/http/movie.http b/api/http/movie.http new file mode 100644 index 000000000..9a13e46b8 --- /dev/null +++ b/api/http/movie.http @@ -0,0 +1,3 @@ +### 1. 상영중인 영화 조회 +GET localhost:8080/v1/movies/now-showing +Content-Type: application/json \ No newline at end of file diff --git a/api/src/main/java/com/example/Hang99Application.java b/api/src/main/java/com/example/Hang99Application.java new file mode 100644 index 000000000..a6844cc65 --- /dev/null +++ b/api/src/main/java/com/example/Hang99Application.java @@ -0,0 +1,24 @@ +package com.example; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.data.domain.AuditorAware; +import org.springframework.data.jpa.repository.config.EnableJpaAuditing; + +import java.util.Optional; +import java.util.UUID; + +@EnableJpaAuditing +@SpringBootApplication +public class Hang99Application { + + public static void main(String[] args) { + SpringApplication.run(Hang99Application.class, args); + } + + @Bean + public AuditorAware auditorProvider(){ + return () -> Optional.of("SYSTEM"); + } +} \ No newline at end of file diff --git a/api/src/main/java/com/example/exception/BaseException.java b/api/src/main/java/com/example/exception/BaseException.java new file mode 100644 index 000000000..c339c15d9 --- /dev/null +++ b/api/src/main/java/com/example/exception/BaseException.java @@ -0,0 +1,20 @@ +package com.example.exception; + +import com.example.response.status.ResponseStatus; +import lombok.Getter; + +@Getter +public class BaseException extends RuntimeException{ + private final ResponseStatus exceptionStatus; + + + public BaseException(ResponseStatus exceptionStatus) { + super(exceptionStatus.getMessage()); + this.exceptionStatus = exceptionStatus; + } + + public BaseException(String exceptionMessage, ResponseStatus exceptionStatus) { + super(exceptionMessage); + this.exceptionStatus = exceptionStatus; + } +} diff --git a/api/src/main/java/com/example/exception/BaseExceptionHandler.java b/api/src/main/java/com/example/exception/BaseExceptionHandler.java new file mode 100644 index 000000000..e9652425f --- /dev/null +++ b/api/src/main/java/com/example/exception/BaseExceptionHandler.java @@ -0,0 +1,68 @@ +package com.example.exception; + +import com.example.response.BaseErrorResponse; +import com.example.response.code.BaseCode; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.TypeMismatchException; +import org.springframework.http.HttpStatus; +import org.springframework.web.HttpRequestMethodNotSupportedException; +import org.springframework.web.bind.MissingServletRequestParameterException; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.bind.annotation.RestControllerAdvice; +import org.springframework.web.servlet.NoHandlerFoundException; + +import java.io.IOException; + +@Slf4j +@RestControllerAdvice +public class BaseExceptionHandler { + @ResponseStatus(HttpStatus.BAD_REQUEST) + @ExceptionHandler({BaseException.class,NoHandlerFoundException.class, TypeMismatchException.class}) + public BaseErrorResponse handle_BadRequest(Exception exception) { + log.info("[BaseExceptionControllerAdvice: handle_BadRequest 호출]", exception); + return new BaseErrorResponse(BaseCode.URL_NOT_FOUND); + } + + @ResponseStatus(HttpStatus.BAD_REQUEST) + @ExceptionHandler(HttpRequestMethodNotSupportedException.class) + public BaseErrorResponse handle_HttpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e) { + log.info("[BaseExceptionControllerAdvice: handle_HttpRequestMethodNotSupportedException 호출]", e); + return new BaseErrorResponse(BaseCode.METHOD_NOT_ALLOWED); + } + + @ResponseStatus(HttpStatus.BAD_REQUEST) + @ExceptionHandler(IllegalArgumentException.class) + public BaseErrorResponse handle_IllegalArgumentException(IllegalArgumentException e) { + log.info("[BaseExceptionControllerAdvice: handle_IllegalArgumentException 호출]", e); + return new BaseErrorResponse(BaseCode.BAD_REQUEST, e.getMessage()); + } + + @ResponseStatus(HttpStatus.BAD_REQUEST) + @ExceptionHandler(IllegalStateException.class) + public BaseErrorResponse handle_IllegalStatusException(IllegalStateException e) { + log.info("[BaseExceptionControllerAdvice: handle_IllegalStatusException 호출]", e); + return new BaseErrorResponse(BaseCode.BAD_REQUEST, e.getMessage()); + } + + @ResponseStatus(HttpStatus.BAD_REQUEST) + @ExceptionHandler(IOException.class) + public BaseErrorResponse handle_IOException(IOException e) { + log.info("[BaseExceptionControllerAdvice: handle_IOException 호출]", e); + return new BaseErrorResponse(BaseCode.BAD_REQUEST, e.getMessage()); + } + + @ResponseStatus(HttpStatus.BAD_REQUEST) + @ExceptionHandler(MissingServletRequestParameterException.class) + public BaseErrorResponse handleMissingServletRequestParameterException(MissingServletRequestParameterException e) { + log.info("[GlobalExceptionHandler] MissingServletRequestParameterException", e); + return new BaseErrorResponse(BaseCode.NO_REQUEST_PARAMETER); + } + + @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) + @ExceptionHandler(RuntimeException.class) + public BaseErrorResponse handle_RuntimeException(Exception e) { + log.error("[BaseExceptionControllerAdvice: handle_RuntimeException 호출]", e); + return new BaseErrorResponse(BaseCode.SERVER_ERROR); + } +} diff --git a/api/src/main/java/com/example/movie/application/convertor/DtoConvertor.java b/api/src/main/java/com/example/movie/application/convertor/DtoConvertor.java new file mode 100644 index 000000000..d08bef55e --- /dev/null +++ b/api/src/main/java/com/example/movie/application/convertor/DtoConvertor.java @@ -0,0 +1,57 @@ +package com.example.movie.application.convertor; + +import com.example.movie.repository.dto.MoviesNowShowingDetailDto; +import com.example.movie.application.dto.MoviesNowShowingDetail; +import com.example.movie.application.dto.ScreeningTimeDetail; +import com.example.movie.application.dto.ScreeningsDetail; +import lombok.NoArgsConstructor; +import org.springframework.stereotype.Component; + +import java.util.Comparator; +import java.util.List; +import java.util.stream.Collectors; + +@Component +@NoArgsConstructor +public class DtoConvertor { + public List moviesNowScreening(List dbResults) { + return dbResults.stream() + .collect(Collectors.groupingBy(MoviesNowShowingDetailDto::getMovieId)) + .entrySet().stream() + .map(entry -> { + Long movieId = entry.getKey(); + List groupedByMovie = entry.getValue(); + + + MoviesNowShowingDetailDto firstEntry = groupedByMovie.get(0); + + + List screeningsDetails = groupedByMovie.stream() + .collect(Collectors.groupingBy(MoviesNowShowingDetailDto::getTheaterId)) + .entrySet().stream() + .map(theaterEntry -> { + Long theaterId = theaterEntry.getKey(); + String theaterName = theaterEntry.getValue().get(0).getTheaterName(); + List screeningTimes = theaterEntry.getValue().stream() + .sorted(Comparator.comparing(MoviesNowShowingDetailDto::getStartAt)) + .map(dto -> new ScreeningTimeDetail(dto.getStartAt(), dto.getEndAt())) + .toList(); + return new ScreeningsDetail(theaterId, theaterName, screeningTimes); + }) + .toList(); + + // Create the final DTO + return new MoviesNowShowingDetail( + movieId, // Add movieId here + firstEntry.getMovieName(), + firstEntry.getGrade(), + firstEntry.getReleaseDate(), + firstEntry.getThumbnail(), + firstEntry.getRunningTime(), + firstEntry.getGenre(), + screeningsDetails + ); + }) + .toList(); + } +} diff --git a/api/src/main/java/com/example/movie/application/dto/MoviesNowShowingDetail.java b/api/src/main/java/com/example/movie/application/dto/MoviesNowShowingDetail.java new file mode 100644 index 000000000..5e7e0a8c2 --- /dev/null +++ b/api/src/main/java/com/example/movie/application/dto/MoviesNowShowingDetail.java @@ -0,0 +1,19 @@ +package com.example.movie.application.dto; + +import com.example.movie.entity.movie.Genre; +import com.example.movie.entity.movie.Grade; + +import java.time.LocalDate; +import java.util.List; + +public record MoviesNowShowingDetail ( + Long movieId, + String movieName, + Grade grade, + LocalDate releaseDate, + String thumbnail, + Long runningTime, + Genre genre, + List screeningsDetails +) { +} diff --git a/api/src/main/java/com/example/movie/application/dto/ScreeningTimeDetail.java b/api/src/main/java/com/example/movie/application/dto/ScreeningTimeDetail.java new file mode 100644 index 000000000..6d5784032 --- /dev/null +++ b/api/src/main/java/com/example/movie/application/dto/ScreeningTimeDetail.java @@ -0,0 +1,9 @@ +package com.example.movie.application.dto; + +import java.time.LocalDateTime; + +public record ScreeningTimeDetail( + LocalDateTime startAt, + LocalDateTime endAt +) { +} diff --git a/api/src/main/java/com/example/movie/application/dto/ScreeningsDetail.java b/api/src/main/java/com/example/movie/application/dto/ScreeningsDetail.java new file mode 100644 index 000000000..d42fa7ba6 --- /dev/null +++ b/api/src/main/java/com/example/movie/application/dto/ScreeningsDetail.java @@ -0,0 +1,10 @@ +package com.example.movie.application.dto; + +import java.util.List; + +public record ScreeningsDetail( + Long theaterId, + String theater, + List screeningTimes +) { +} diff --git a/api/src/main/java/com/example/movie/application/service/MovieService.java b/api/src/main/java/com/example/movie/application/service/MovieService.java new file mode 100644 index 000000000..3f05d825a --- /dev/null +++ b/api/src/main/java/com/example/movie/application/service/MovieService.java @@ -0,0 +1,31 @@ +package com.example.movie.application.service; + +import com.example.movie.application.convertor.DtoConvertor; +import com.example.movie.application.dto.MoviesNowShowingDetail; +import com.example.movie.entity.movie.Genre; +import com.example.movie.repository.MovieRepository; +import com.example.movie.repository.dto.MoviesNowShowingDetailDto; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.util.Comparator; +import java.util.List; + +@Service +@RequiredArgsConstructor +public class MovieService { + + private final MovieRepository movieRepository; + private final DtoConvertor dtoConvertor; + + public List getMoviesNowShowing(LocalDateTime now, Genre genre, String search) { + List dbResults = movieRepository.findNowShowing(now); + List detailsList = dtoConvertor.moviesNowScreening(dbResults); + + return detailsList.stream() + .sorted(Comparator.comparing(MoviesNowShowingDetail::releaseDate)) + .toList(); + } + +} diff --git a/api/src/main/java/com/example/movie/presentation/controller/MovieController.java b/api/src/main/java/com/example/movie/presentation/controller/MovieController.java new file mode 100644 index 000000000..6361b05bc --- /dev/null +++ b/api/src/main/java/com/example/movie/presentation/controller/MovieController.java @@ -0,0 +1,30 @@ +package com.example.movie.presentation.controller; + +import com.example.movie.application.dto.MoviesNowShowingDetail; +import com.example.movie.application.service.MovieService; +import com.example.movie.entity.movie.Genre; +import com.example.response.BaseResponse; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.time.LocalDateTime; +import java.util.List; + +@RestController +@RequiredArgsConstructor +public class MovieController { + + private final MovieService movieService; + + @GetMapping("/v1/movies/now-showing") + public BaseResponse> getMoviesNowShowing( + @RequestParam(value = "genre", required = false)Genre genre, + @RequestParam(value = "search", required = false)String search + ) { + List response = movieService.getMoviesNowShowing(LocalDateTime.now(), genre, search); + return new BaseResponse<>(response); + } + +} diff --git a/api/src/main/java/com/example/response/BaseErrorResponse.java b/api/src/main/java/com/example/response/BaseErrorResponse.java new file mode 100644 index 000000000..1c584e38a --- /dev/null +++ b/api/src/main/java/com/example/response/BaseErrorResponse.java @@ -0,0 +1,56 @@ +package com.example.response; + +import com.example.response.status.ResponseStatus; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import lombok.Getter; + +import java.time.LocalDateTime; + +@Getter +@JsonPropertyOrder({"code","status","message","timestamp"}) +public class BaseErrorResponse implements ResponseStatus { + private final int code; + private final int status; + private final String message; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss") + private final LocalDateTime timestamp; + + public BaseErrorResponse(ResponseStatus status) { + this.code = status.getCode(); + this.status = status.getStatus(); + this.message = status.getMessage(); + this.timestamp = LocalDateTime.now(); + } + + public BaseErrorResponse(ResponseStatus status, String message) { + this.code = status.getCode(); + this.status = status.getStatus(); + this.message = message; + this.timestamp = LocalDateTime.now(); + } + + @Override + public int getCode() { + return code; + } + + @Override + public int getStatus() { + return status; + } + + @Override + public String getMessage() { + return message; + } + + public String convertToJson() throws JsonProcessingException { + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.registerModule(new JavaTimeModule()); + return objectMapper.writeValueAsString(this); + } +} diff --git a/api/src/main/java/com/example/response/BaseResponse.java b/api/src/main/java/com/example/response/BaseResponse.java new file mode 100644 index 000000000..5efaea3ce --- /dev/null +++ b/api/src/main/java/com/example/response/BaseResponse.java @@ -0,0 +1,48 @@ +package com.example.response; + +import com.example.response.status.ResponseStatus; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import lombok.Getter; + +import static com.example.response.code.BaseCode.SUCCESS; + + +@Getter +@JsonPropertyOrder({"code","status","message","result"}) +public class BaseResponse implements ResponseStatus { + private final int code; + private final int status; + private final String message; + + @JsonInclude(JsonInclude.Include.NON_NULL) + private final T result; + + + public BaseResponse() { + this.code = SUCCESS.getCode(); + this.status = SUCCESS.getStatus(); + this.message = SUCCESS.getMessage(); + this.result = null; + } + + public BaseResponse(T result) { + this.code = SUCCESS.getCode(); + this.status = SUCCESS.getStatus(); + this.message = SUCCESS.getMessage(); + this.result = result; + } + + public int getCode() { + return code; + } + + public int getStatus() { + return status; + } + + public String getMessage() { + return message; + } +} + diff --git a/api/src/main/java/com/example/response/code/BaseCode.java b/api/src/main/java/com/example/response/code/BaseCode.java new file mode 100644 index 000000000..f5fb7fcf1 --- /dev/null +++ b/api/src/main/java/com/example/response/code/BaseCode.java @@ -0,0 +1,50 @@ +package com.example.response.code; + +import com.example.response.status.ResponseStatus; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +@RequiredArgsConstructor +public enum BaseCode implements ResponseStatus { + + /** + * 1000: 요청 성공 (OK) + */ + SUCCESS(1000,HttpStatus.OK.value(), "요청에 성공하였습니다."), + + /** + * 2000: Request 오류 (BAD_REQUEST) + */ + BAD_REQUEST(2000, HttpStatus.BAD_REQUEST.value(), "유효하지 않은 요청입니다."), + URL_NOT_FOUND(2001, HttpStatus.BAD_REQUEST.value(), "유효하지 않은 URL 입니다."), + METHOD_NOT_ALLOWED(2002, HttpStatus.METHOD_NOT_ALLOWED.value(), "해당 URL에서는 지원하지 않는 HTTP Method 입니다."), + NO_REQUEST_PARAMETER(2005,HttpStatus.BAD_REQUEST.value(),"요청 파라미터는 필수로 입력해야합니다."), + + + /** + * 3000: Server, Database 오류 (INTERNAL_SERVER_ERROR) + */ + SERVER_ERROR(3000, HttpStatus.INTERNAL_SERVER_ERROR.value(), "서버에서 오류가 발생하였습니다."), + DATABASE_ERROR(3001, HttpStatus.INTERNAL_SERVER_ERROR.value(), "데이터베이스에서 오류가 발생하였습니다."), + BAD_SQL_GRAMMAR(3002, HttpStatus.INTERNAL_SERVER_ERROR.value(), "SQL에 오류가 있습니다."); + + private final int code; + private final int status; + private final String message; + + + @Override + public int getCode() { + return code; + } + + @Override + public int getStatus() { + return status; + } + + @Override + public String getMessage() { + return message; + } +} diff --git a/api/src/main/java/com/example/response/status/ResponseStatus.java b/api/src/main/java/com/example/response/status/ResponseStatus.java new file mode 100644 index 000000000..5762a4956 --- /dev/null +++ b/api/src/main/java/com/example/response/status/ResponseStatus.java @@ -0,0 +1,7 @@ +package com.example.response.status; + +public interface ResponseStatus { + int getCode(); + int getStatus(); + String getMessage(); +} \ No newline at end of file diff --git a/api/src/test/java/com/example/movie/application/service/MovieServiceTest.java b/api/src/test/java/com/example/movie/application/service/MovieServiceTest.java new file mode 100644 index 000000000..4e64034f1 --- /dev/null +++ b/api/src/test/java/com/example/movie/application/service/MovieServiceTest.java @@ -0,0 +1,17 @@ +package com.example.movie.application.service; + +import com.example.movie.repository.MovieRepository; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.bean.override.mockito.MockitoBean; + +@SpringBootTest +class MovieServiceTest { + @MockitoBean + private MovieRepository movieRepository; + + @Test + public void 테스트(){ + + } +} \ No newline at end of file diff --git a/api/src/test/java/com/example/movie/presentation/controller/MovieControllerTest.java b/api/src/test/java/com/example/movie/presentation/controller/MovieControllerTest.java new file mode 100644 index 000000000..1a1189506 --- /dev/null +++ b/api/src/test/java/com/example/movie/presentation/controller/MovieControllerTest.java @@ -0,0 +1,32 @@ +package com.example.movie.presentation.controller; + +import com.example.movie.application.service.MovieService; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.http.MediaType; +import org.springframework.test.context.bean.override.mockito.MockitoBean; +import org.springframework.test.web.servlet.MockMvc; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +@WebMvcTest(controllers = MovieController.class) +class MovieControllerTest { + + @Autowired + private MockMvc mockMvc; + @MockitoBean + private MovieService movieService; + + @Test + @DisplayName("장르 필터링 시 Enum 값이 아니면 예외가 발생한다.") + void 장르필터링_예외() throws Exception { + mockMvc.perform(get("/v1/movies/now-showing") + .param("genre","weirdInput") + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()); + } + +} \ No newline at end of file diff --git a/api/src/test/resources/application.yml b/api/src/test/resources/application.yml new file mode 100644 index 000000000..7967e2b81 --- /dev/null +++ b/api/src/test/resources/application.yml @@ -0,0 +1,33 @@ +spring: + profiles: + active: test + +--- + +spring: + datasource: + url: jdbc:h2:mem:db;MODE=MYSQL + username: sa + password: + driver-class-name: org.h2.Driver + h2: + console: + enabled: true + path: /h2-console + jpa: + defer-datasource-initialization: true + database-platform: org.hibernate.dialect.H2Dialect + hibernate: + ddl-auto: create-drop + properties: + hibernate: + format_sql: true + generate-ddl: true + sql: + init: + data-locations: classpath:data.sql + mode: always + +logging: + level: + org.hibernate.SQL: debug \ No newline at end of file diff --git a/api/src/test/resources/data.sql b/api/src/test/resources/data.sql new file mode 100644 index 000000000..dfe5d6556 --- /dev/null +++ b/api/src/test/resources/data.sql @@ -0,0 +1,57 @@ +-- Theater Data +INSERT INTO theater (id, name, create_at, modify_at) +VALUES + (1, '상영관 1관', CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (2, '상영관 2관', CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (3, '상영관 3관', CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (4, '상영관 4관', CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (5, '상영관 5관', CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (6, '상영관 6관', CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (7, '상영관 7관', CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (8, '상영관 8관', CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (9, '상영관 9관', CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (10, '상영관 10관', CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()); + +-- Movie Data +INSERT INTO movie (id, name, thumbnail, genre, grade, release_date, running_time, create_at, modify_at) +VALUES + (1, '범죄도시', NULL, 'ACTION', 'FROM_15_AGE', DATEADD('DAY', -30, CURRENT_DATE()), 120, CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), --30일 전 개봉 + (2, '파일럿', NULL, 'SF', 'FROM_12_AGE', DATEADD('DAY', -15, CURRENT_DATE()), 135, CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), --15일 전 개봉 + (3, '기생충', NULL, 'ROMANCE', 'FROM_15_AGE', DATEADD('DAY', -10, CURRENT_DATE()), 132, CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), --10일 전 개봉 + (4, '인셉션', NULL, 'SF', 'FROM_15_AGE', DATEADD('DAY', -100, CURRENT_DATE()), 148, CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), --100일 전 개봉 + (5, '어벤져스: 엔드게임', NULL, 'ACTION', 'FROM_12_AGE', DATEADD('DAY', 100, CURRENT_DATE()), 181, CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()); --100일 후 개봉 + +-- Screening Data +-- 범죄도시 상영 스케줄 (종료) +INSERT INTO screening (id, movie_id, theater_id, start_at, end_at, create_at, modify_at) +VALUES + (1, 1, 1, TIMESTAMPADD(HOUR, 12, DATEADD('DAY', -30, CURRENT_DATE())), TIMESTAMPADD(HOUR, 14, DATEADD('DAY', -30, CURRENT_DATE())), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (2, 1, 2, TIMESTAMPADD(HOUR, 14, DATEADD('DAY', -30, CURRENT_DATE())), TIMESTAMPADD(HOUR, 16, DATEADD('DAY', -30, CURRENT_DATE())), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (3, 1, 3, TIMESTAMPADD(HOUR, 15, DATEADD('DAY', -30, CURRENT_DATE())), TIMESTAMPADD(HOUR, 17, DATEADD('DAY', -30, CURRENT_DATE())), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (4, 1, 4, TIMESTAMPADD(HOUR, 17, DATEADD('DAY', -30, CURRENT_DATE())), TIMESTAMPADD(HOUR, 19, DATEADD('DAY', -30, CURRENT_DATE())), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (5, 1, 5, TIMESTAMPADD(HOUR, 36, DATEADD('DAY', -30, CURRENT_DATE())), TIMESTAMPADD(HOUR, 38, DATEADD('DAY', -30, CURRENT_DATE())), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()); + +-- 파일럿 상영 스케줄 (진행) +INSERT INTO screening (id, movie_id, theater_id, start_at, end_at, create_at, modify_at) +VALUES + (6, 2, 2, TIMESTAMPADD(HOUR, -12, CURRENT_TIMESTAMP()), TIMESTAMPADD(HOUR, -10, CURRENT_TIMESTAMP()), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (7, 2, 3, TIMESTAMPADD(HOUR, 14, CURRENT_TIMESTAMP()), TIMESTAMPADD(HOUR, 16, CURRENT_TIMESTAMP()), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (8, 2, 4, TIMESTAMPADD(HOUR, 15, CURRENT_TIMESTAMP()), TIMESTAMPADD(HOUR, 17, CURRENT_TIMESTAMP()), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (9, 2, 5, TIMESTAMPADD(HOUR, 17, CURRENT_TIMESTAMP()), TIMESTAMPADD(HOUR, 19, CURRENT_TIMESTAMP()), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (10, 2, 6, TIMESTAMPADD(HOUR, 36, CURRENT_TIMESTAMP()), TIMESTAMPADD(HOUR, 38, CURRENT_TIMESTAMP()), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()); + +-- 기생충 상영 스케줄 (진행) +INSERT INTO screening (id, movie_id, theater_id, start_at, end_at, create_at, modify_at) +VALUES + (11, 3, 3, TIMESTAMPADD(HOUR, -10, CURRENT_TIMESTAMP()), TIMESTAMPADD(HOUR, -8, CURRENT_TIMESTAMP()), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (12, 3, 4, TIMESTAMPADD(HOUR, 13, CURRENT_TIMESTAMP()), TIMESTAMPADD(HOUR, 15, CURRENT_TIMESTAMP()), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (13, 3, 5, TIMESTAMPADD(HOUR, 14, CURRENT_TIMESTAMP()), TIMESTAMPADD(HOUR, 16, CURRENT_TIMESTAMP()), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (14, 3, 6, TIMESTAMPADD(HOUR, 18, CURRENT_TIMESTAMP()), TIMESTAMPADD(HOUR, 20, CURRENT_TIMESTAMP()), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (15, 3, 7, TIMESTAMPADD(HOUR, 20, CURRENT_TIMESTAMP()), TIMESTAMPADD(HOUR, 22, CURRENT_TIMESTAMP()), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()); + +-- 인셉션 상영 스케줄 (종료) +INSERT INTO screening (id, movie_id, theater_id, start_at, end_at, create_at, modify_at) +VALUES + (16, 4, 4, TIMESTAMPADD(HOUR, 10, DATEADD('DAY', -100, CURRENT_DATE())), TIMESTAMPADD(HOUR, 12, DATEADD('DAY', -100, CURRENT_DATE())), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (17, 4, 5, TIMESTAMPADD(HOUR, 13, DATEADD('DAY', -100, CURRENT_DATE())), TIMESTAMPADD(HOUR, 15, DATEADD('DAY', -100, CURRENT_DATE())), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (18, 4, 6, TIMESTAMPADD(HOUR, 14, DATEADD('DAY', -100, CURRENT_DATE())), TIMESTAMPADD(HOUR, 16, DATEADD('DAY', -100, CURRENT_DATE())), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()); diff --git a/build.gradle b/build.gradle new file mode 100644 index 000000000..0dce6d3f4 --- /dev/null +++ b/build.gradle @@ -0,0 +1,48 @@ +plugins { + id 'java' + id 'org.springframework.boot' version '3.4.1' + id 'io.spring.dependency-management' version '1.1.7' +} + +repositories { + mavenCentral() +} + +subprojects { + // 모든 하위 모듈들에 이 설정을 적용 + group 'com.example' + version '0.0.1-SNAPSHOT' + sourceCompatibility = '17' + + apply plugin: 'java' + apply plugin: 'java-library' + apply plugin: 'org.springframework.boot' + apply plugin: 'io.spring.dependency-management' + + configurations { + compileOnly { + extendsFrom annotationProcessor + } + } + + repositories { + mavenCentral() + } + + dependencies { // 모든 하위 모듈에 추가 될 의존성 목록입니다. + implementation 'org.springframework.boot:spring-boot-starter' + compileOnly 'org.projectlombok:lombok' + annotationProcessor 'org.projectlombok:lombok' + testImplementation 'org.springframework.boot:spring-boot-starter-test' + testImplementation 'com.h2database:h2' + testRuntimeOnly 'org.junit.platform:junit-platform-launcher' + testImplementation 'org.junit.jupiter:junit-jupiter:5.7.1' + testImplementation "org.testcontainers:testcontainers:1.19.0" + testImplementation "org.testcontainers:junit-jupiter:1.19.0" + } + + test { + useJUnitPlatform() + } + +} \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..8f5457812 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +version: '3.8' +services: + mysql: + image: mysql:latest # 이미 로컬에 있는 MySQL 이미지 사용 + environment: + MYSQL_ROOT_PASSWORD: 1234 # 루트 계정 비밀번호 + MYSQL_DATABASE: hanghae99 # 생성할 기본 데이터베이스 + MYSQL_USER: user # 사용자 계정 (선택) + MYSQL_PASSWORD: password # 사용자 비밀번호 (선택) + ports: + - "3305:3306" # 호스트의 3306 포트를 컨테이너의 3306 포트와 연결 \ No newline at end of file diff --git a/domain/build.gradle b/domain/build.gradle new file mode 100644 index 000000000..964907fed --- /dev/null +++ b/domain/build.gradle @@ -0,0 +1,8 @@ +bootJar.enabled = false + +jar.enabled = true + +dependencies { + runtimeOnly 'com.mysql:mysql-connector-j' + api("org.springframework.boot:spring-boot-starter-data-jpa") +} \ No newline at end of file diff --git a/domain/src/main/java/com/example/BaseEntity.java b/domain/src/main/java/com/example/BaseEntity.java new file mode 100644 index 000000000..51396fb81 --- /dev/null +++ b/domain/src/main/java/com/example/BaseEntity.java @@ -0,0 +1,37 @@ +package com.example; + +import jakarta.persistence.Column; +import jakarta.persistence.EntityListeners; +import jakarta.persistence.MappedSuperclass; +import lombok.Data; +import org.springframework.data.annotation.CreatedBy; +import org.springframework.data.annotation.CreatedDate; +import org.springframework.data.annotation.LastModifiedBy; +import org.springframework.data.annotation.LastModifiedDate; +import org.springframework.data.jpa.domain.support.AuditingEntityListener; + +import java.time.LocalDateTime; + +@Data +@EntityListeners(AuditingEntityListener.class) +@MappedSuperclass +public abstract class BaseEntity { + + @CreatedDate + @Column(updatable = false) + private LocalDateTime createAt; + + + @LastModifiedDate + private LocalDateTime modifyAt; + + + @CreatedBy + @Column(updatable = false) + private String createBy; + + + @LastModifiedBy + private String modifyBy; + +} diff --git a/domain/src/main/java/com/example/movie/entity/movie/Genre.java b/domain/src/main/java/com/example/movie/entity/movie/Genre.java new file mode 100644 index 000000000..5021471aa --- /dev/null +++ b/domain/src/main/java/com/example/movie/entity/movie/Genre.java @@ -0,0 +1,5 @@ +package com.example.movie.entity.movie; + +public enum Genre { + ACTION, ROMANCE, HORROR, SF +} diff --git a/domain/src/main/java/com/example/movie/entity/movie/Grade.java b/domain/src/main/java/com/example/movie/entity/movie/Grade.java new file mode 100644 index 000000000..b437d10c7 --- /dev/null +++ b/domain/src/main/java/com/example/movie/entity/movie/Grade.java @@ -0,0 +1,5 @@ +package com.example.movie.entity.movie; + +public enum Grade { + ALL_AGE, FROM_12_AGE, FROM_15_AGE, FROM_19_AGE, RESTRICTED +} diff --git a/domain/src/main/java/com/example/movie/entity/movie/Movie.java b/domain/src/main/java/com/example/movie/entity/movie/Movie.java new file mode 100644 index 000000000..bbfcec42d --- /dev/null +++ b/domain/src/main/java/com/example/movie/entity/movie/Movie.java @@ -0,0 +1,28 @@ +package com.example.movie.entity.movie; + +import com.example.BaseEntity; +import jakarta.persistence.*; + +import java.time.LocalDate; + +@Entity +public class Movie extends BaseEntity { + + @Id @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + private String name; + + private String thumbnail; + + @Enumerated(EnumType.STRING) + private Genre genre; + + @Enumerated(EnumType.STRING) + private Grade grade; + + private LocalDate releaseDate; + + private Long runningTime; + +} diff --git a/domain/src/main/java/com/example/movie/entity/movie/Screening.java b/domain/src/main/java/com/example/movie/entity/movie/Screening.java new file mode 100644 index 000000000..4f86c8c26 --- /dev/null +++ b/domain/src/main/java/com/example/movie/entity/movie/Screening.java @@ -0,0 +1,26 @@ +package com.example.movie.entity.movie; + +import com.example.BaseEntity; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; + +import java.time.LocalDateTime; + +@Entity +public class Screening extends BaseEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + private Long movieId; + + private Long theaterId; + + private LocalDateTime startAt; + + private LocalDateTime endAt; + +} diff --git a/domain/src/main/java/com/example/movie/entity/theater/Seat.java b/domain/src/main/java/com/example/movie/entity/theater/Seat.java new file mode 100644 index 000000000..fb6c088e3 --- /dev/null +++ b/domain/src/main/java/com/example/movie/entity/theater/Seat.java @@ -0,0 +1,24 @@ +package com.example.movie.entity.theater; + +import com.example.BaseEntity; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import org.springframework.lang.Nullable; + +@Entity +public class Seat extends BaseEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + private Long theaterId; + + @Nullable + private Long userId; + + private String position; + +} diff --git a/domain/src/main/java/com/example/movie/entity/theater/Theater.java b/domain/src/main/java/com/example/movie/entity/theater/Theater.java new file mode 100644 index 000000000..b40c39429 --- /dev/null +++ b/domain/src/main/java/com/example/movie/entity/theater/Theater.java @@ -0,0 +1,18 @@ +package com.example.movie.entity.theater; + +import com.example.BaseEntity; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; + +@Entity +public class Theater extends BaseEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + private String name; + +} diff --git a/domain/src/main/java/com/example/movie/repository/MovieRepository.java b/domain/src/main/java/com/example/movie/repository/MovieRepository.java new file mode 100644 index 000000000..c4c1b592c --- /dev/null +++ b/domain/src/main/java/com/example/movie/repository/MovieRepository.java @@ -0,0 +1,21 @@ +package com.example.movie.repository; + +import com.example.movie.entity.movie.Movie; +import com.example.movie.repository.dto.MoviesNowShowingDetailDto; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; + +import java.time.LocalDateTime; +import java.util.List; + +public interface MovieRepository extends JpaRepository { + + @Query("SELECT new com.example.movie.repository.dto.MoviesNowShowingDetailDto(m.id, m.name, m.grade, m.releaseDate, m.thumbnail, m.runningTime, m.genre, " + + "t.id, t.name, s.startAt, s.endAt) " + + "FROM Movie m " + + "JOIN Screening s ON m.id = s.movieId " + + "JOIN Theater t ON s.theaterId = t.id " + + "WHERE s.startAt >= :now") + List findNowShowing(LocalDateTime now); + +} diff --git a/domain/src/main/java/com/example/movie/repository/dto/MoviesNowShowingDetailDto.java b/domain/src/main/java/com/example/movie/repository/dto/MoviesNowShowingDetailDto.java new file mode 100644 index 000000000..eb9a386e4 --- /dev/null +++ b/domain/src/main/java/com/example/movie/repository/dto/MoviesNowShowingDetailDto.java @@ -0,0 +1,25 @@ +package com.example.movie.repository.dto; + +import com.example.movie.entity.movie.Genre; +import com.example.movie.entity.movie.Grade; +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.time.LocalDate; +import java.time.LocalDateTime; + +@Getter +@AllArgsConstructor +public class MoviesNowShowingDetailDto { + private Long movieId; + private String movieName; + private Grade grade; + private LocalDate releaseDate; + private String thumbnail; + private Long runningTime; + private Genre genre; + private Long theaterId; + private String theaterName; + private LocalDateTime startAt; + private LocalDateTime endAt; +} diff --git a/domain/src/main/java/com/example/reservation/entity/Reservation.java b/domain/src/main/java/com/example/reservation/entity/Reservation.java new file mode 100644 index 000000000..75f202472 --- /dev/null +++ b/domain/src/main/java/com/example/reservation/entity/Reservation.java @@ -0,0 +1,24 @@ +package com.example.reservation.entity; + +import com.example.BaseEntity; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; + +import java.time.LocalDateTime; + +@Entity +public class Reservation extends BaseEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + private Long seatId; + + private Long userId; + + private LocalDateTime reserveAt; + +} diff --git a/domain/src/main/java/com/example/user/entity/User.java b/domain/src/main/java/com/example/user/entity/User.java new file mode 100644 index 000000000..a1fe29b21 --- /dev/null +++ b/domain/src/main/java/com/example/user/entity/User.java @@ -0,0 +1,18 @@ +package com.example.user.entity; + +import com.example.BaseEntity; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; + +@Entity +public class User extends BaseEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + private String name; + +} diff --git a/domain/src/main/resources/application.yml b/domain/src/main/resources/application.yml new file mode 100644 index 000000000..7f70d8eab --- /dev/null +++ b/domain/src/main/resources/application.yml @@ -0,0 +1,19 @@ +spring: + datasource: + url: jdbc:mysql://localhost:3305/hanghae99 + username: root + password: 1234 + driver-class-name: com.mysql.cj.jdbc.Driver + jpa: + defer-datasource-initialization: true + hibernate: + ddl-auto: create-drop + properties: + hibernate: + format_sql: true + show_sql: true + sql: + init: + data-locations: classpath:data.sql + platform: mysql + mode: always diff --git a/domain/src/main/resources/data.sql b/domain/src/main/resources/data.sql new file mode 100644 index 000000000..77ead99c4 --- /dev/null +++ b/domain/src/main/resources/data.sql @@ -0,0 +1,62 @@ +-- Clear existing data +DELETE FROM screening; +DELETE FROM movie; +DELETE FROM theater; + +-- Theater Data +INSERT INTO theater (id, name, create_at, modify_at) +VALUES + (1, '상영관 1관', NOW(), NOW()), + (2, '상영관 2관', NOW(), NOW()), + (3, '상영관 3관', NOW(), NOW()), + (4, '상영관 4관', NOW(), NOW()), + (5, '상영관 5관', NOW(), NOW()), + (6, '상영관 6관', NOW(), NOW()), + (7, '상영관 7관', NOW(), NOW()), + (8, '상영관 8관', NOW(), NOW()), + (9, '상영관 9관', NOW(), NOW()), + (10, '상영관 10관', NOW(), NOW()); + +-- Movie Data +INSERT INTO movie (id, name, thumbnail, genre, grade, release_date, running_time, create_at, modify_at) +VALUES + (1, '범죄도시', NULL, 'ACTION', 'FROM_15_AGE', DATE_ADD(CURRENT_DATE, INTERVAL -30 DAY), 120, NOW(), NOW()), --2달 전 개봉 + (2, '파일럿', NULL, 'SF', 'FROM_12_AGE', DATE_ADD(CURRENT_DATE, INTERVAL -15 DAY), 135, NOW(), NOW()), --15일 전 개봉 + (3, '기생충', NULL, 'ROMANCE', 'FROM_15_AGE', DATE_ADD(CURRENT_DATE, INTERVAL -10 DAY), 132, NOW(), NOW()), --10일 전 개봉 + (4, '인셉션', NULL, 'SF', 'FROM_15_AGE', DATE_ADD(CURRENT_DATE, INTERVAL -100 DAY), 148, NOW(), NOW()), --3달 전 개봉 + (5, '어벤져스: 엔드게임', NULL, 'ACTION', 'FROM_12_AGE', DATE_ADD(CURRENT_DATE, INTERVAL +100 DAY), 181, NOW(), NOW()); --3달 후 개봉 + +-- Screening Data +-- 범죄도시 상영 스케줄 (종료) +INSERT INTO screening (id, movie_id, theater_id, start_at, end_at, create_at, modify_at) +VALUES + (1, 1, 1, DATE_ADD(DATE_ADD(CURRENT_DATE, INTERVAL -30 DAY), INTERVAL 12 HOUR), DATE_ADD(DATE_ADD(CURRENT_DATE, INTERVAL -30 DAY), INTERVAL 14 HOUR), NOW(), NOW()), + (2, 1, 2, DATE_ADD(DATE_ADD(CURRENT_DATE, INTERVAL -30 DAY), INTERVAL 14 HOUR), DATE_ADD(DATE_ADD(CURRENT_DATE, INTERVAL -30 DAY), INTERVAL 16 HOUR), NOW(), NOW()), + (3, 1, 3, DATE_ADD(DATE_ADD(CURRENT_DATE, INTERVAL -30 DAY), INTERVAL 15 HOUR ), DATE_ADD(DATE_ADD(CURRENT_DATE, INTERVAL -30 DAY), INTERVAL 17 HOUR), NOW(), NOW()), + (4, 1, 4, DATE_ADD(DATE_ADD(CURRENT_DATE, INTERVAL -30 DAY), INTERVAL 17 HOUR), DATE_ADD(DATE_ADD(CURRENT_DATE, INTERVAL -30 DAY), INTERVAL 19 HOUR), NOW(), NOW()), + (5, 1, 5, DATE_ADD(DATE_ADD(CURRENT_DATE, INTERVAL -30 DAY), INTERVAL 36 HOUR), DATE_ADD(DATE_ADD(CURRENT_DATE, INTERVAL -30 DAY), INTERVAL 38 HOUR), NOW(), NOW()); + +-- 파일럿 상영 스케줄 (진행) +INSERT INTO screening (id, movie_id, theater_id, start_at, end_at, create_at, modify_at) +VALUES + (6, 2, 2, DATE_ADD(CURRENT_DATE, INTERVAL -12 HOUR), DATE_ADD(CURRENT_DATE, INTERVAL -10 HOUR), NOW(), NOW()), + (7, 2, 3, DATE_ADD(CURRENT_DATE, INTERVAL 14 HOUR), DATE_ADD(CURRENT_DATE, INTERVAL 16 HOUR), NOW(), NOW()), + (8, 2, 4, DATE_ADD(CURRENT_DATE, INTERVAL 15 HOUR), DATE_ADD(CURRENT_DATE, INTERVAL 17 HOUR), NOW(), NOW()), + (9, 2, 5, DATE_ADD(CURRENT_DATE, INTERVAL 17 HOUR), DATE_ADD(CURRENT_DATE, INTERVAL 19 HOUR), NOW(), NOW()), + (10, 2, 6, DATE_ADD(CURRENT_DATE, INTERVAL 36 HOUR), DATE_ADD(CURRENT_DATE, INTERVAL 38 HOUR), NOW(), NOW()); + +-- 기생충 상영 스케줄 (진행) +INSERT INTO screening (id, movie_id, theater_id, start_at, end_at, create_at, modify_at) +VALUES + (11, 3, 3, DATE_ADD(CURRENT_DATE, INTERVAL -10 HOUR), DATE_ADD(CURRENT_DATE, INTERVAL -8 HOUR), NOW(), NOW()), + (12, 3, 4, DATE_ADD(CURRENT_DATE, INTERVAL 13 HOUR), DATE_ADD(CURRENT_DATE, INTERVAL 15 HOUR), NOW(), NOW()), + (13, 3, 5, DATE_ADD(CURRENT_DATE, INTERVAL 14 HOUR), DATE_ADD(CURRENT_DATE, INTERVAL 16 HOUR), NOW(), NOW()), + (14, 3, 6, DATE_ADD(CURRENT_DATE, INTERVAL 18 HOUR), DATE_ADD(CURRENT_DATE, INTERVAL 20 HOUR), NOW(), NOW()), + (15, 3, 7, DATE_ADD(CURRENT_DATE, INTERVAL 20 HOUR), DATE_ADD(CURRENT_DATE, INTERVAL 22 HOUR), NOW(), NOW()); + +-- 인셉션 상영 스케줄 (종료) +INSERT INTO screening (id, movie_id, theater_id, start_at, end_at, create_at, modify_at) +VALUES + (16, 4, 4, DATE_ADD(DATE_ADD(CURRENT_DATE, INTERVAL -100 DAY), INTERVAL 10 HOUR), DATE_ADD(DATE_ADD(CURRENT_DATE, INTERVAL -100 DAY), INTERVAL 12 HOUR), NOW(), NOW()), + (17, 4, 5, DATE_ADD(DATE_ADD(CURRENT_DATE, INTERVAL -100 DAY), INTERVAL 13 HOUR), DATE_ADD(DATE_ADD(CURRENT_DATE, INTERVAL -100 DAY), INTERVAL 15 HOUR), NOW(), NOW()), + (18, 4, 6, DATE_ADD(DATE_ADD(CURRENT_DATE, INTERVAL -100 DAY), INTERVAL 14 HOUR), DATE_ADD(DATE_ADD(CURRENT_DATE, INTERVAL -100 DAY), INTERVAL 16 HOUR), NOW(), NOW()); \ No newline at end of file diff --git a/domain/src/test/resources/application.yml b/domain/src/test/resources/application.yml new file mode 100644 index 000000000..7967e2b81 --- /dev/null +++ b/domain/src/test/resources/application.yml @@ -0,0 +1,33 @@ +spring: + profiles: + active: test + +--- + +spring: + datasource: + url: jdbc:h2:mem:db;MODE=MYSQL + username: sa + password: + driver-class-name: org.h2.Driver + h2: + console: + enabled: true + path: /h2-console + jpa: + defer-datasource-initialization: true + database-platform: org.hibernate.dialect.H2Dialect + hibernate: + ddl-auto: create-drop + properties: + hibernate: + format_sql: true + generate-ddl: true + sql: + init: + data-locations: classpath:data.sql + mode: always + +logging: + level: + org.hibernate.SQL: debug \ No newline at end of file diff --git a/domain/src/test/resources/data.sql b/domain/src/test/resources/data.sql new file mode 100644 index 000000000..dfe5d6556 --- /dev/null +++ b/domain/src/test/resources/data.sql @@ -0,0 +1,57 @@ +-- Theater Data +INSERT INTO theater (id, name, create_at, modify_at) +VALUES + (1, '상영관 1관', CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (2, '상영관 2관', CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (3, '상영관 3관', CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (4, '상영관 4관', CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (5, '상영관 5관', CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (6, '상영관 6관', CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (7, '상영관 7관', CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (8, '상영관 8관', CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (9, '상영관 9관', CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (10, '상영관 10관', CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()); + +-- Movie Data +INSERT INTO movie (id, name, thumbnail, genre, grade, release_date, running_time, create_at, modify_at) +VALUES + (1, '범죄도시', NULL, 'ACTION', 'FROM_15_AGE', DATEADD('DAY', -30, CURRENT_DATE()), 120, CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), --30일 전 개봉 + (2, '파일럿', NULL, 'SF', 'FROM_12_AGE', DATEADD('DAY', -15, CURRENT_DATE()), 135, CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), --15일 전 개봉 + (3, '기생충', NULL, 'ROMANCE', 'FROM_15_AGE', DATEADD('DAY', -10, CURRENT_DATE()), 132, CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), --10일 전 개봉 + (4, '인셉션', NULL, 'SF', 'FROM_15_AGE', DATEADD('DAY', -100, CURRENT_DATE()), 148, CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), --100일 전 개봉 + (5, '어벤져스: 엔드게임', NULL, 'ACTION', 'FROM_12_AGE', DATEADD('DAY', 100, CURRENT_DATE()), 181, CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()); --100일 후 개봉 + +-- Screening Data +-- 범죄도시 상영 스케줄 (종료) +INSERT INTO screening (id, movie_id, theater_id, start_at, end_at, create_at, modify_at) +VALUES + (1, 1, 1, TIMESTAMPADD(HOUR, 12, DATEADD('DAY', -30, CURRENT_DATE())), TIMESTAMPADD(HOUR, 14, DATEADD('DAY', -30, CURRENT_DATE())), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (2, 1, 2, TIMESTAMPADD(HOUR, 14, DATEADD('DAY', -30, CURRENT_DATE())), TIMESTAMPADD(HOUR, 16, DATEADD('DAY', -30, CURRENT_DATE())), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (3, 1, 3, TIMESTAMPADD(HOUR, 15, DATEADD('DAY', -30, CURRENT_DATE())), TIMESTAMPADD(HOUR, 17, DATEADD('DAY', -30, CURRENT_DATE())), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (4, 1, 4, TIMESTAMPADD(HOUR, 17, DATEADD('DAY', -30, CURRENT_DATE())), TIMESTAMPADD(HOUR, 19, DATEADD('DAY', -30, CURRENT_DATE())), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (5, 1, 5, TIMESTAMPADD(HOUR, 36, DATEADD('DAY', -30, CURRENT_DATE())), TIMESTAMPADD(HOUR, 38, DATEADD('DAY', -30, CURRENT_DATE())), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()); + +-- 파일럿 상영 스케줄 (진행) +INSERT INTO screening (id, movie_id, theater_id, start_at, end_at, create_at, modify_at) +VALUES + (6, 2, 2, TIMESTAMPADD(HOUR, -12, CURRENT_TIMESTAMP()), TIMESTAMPADD(HOUR, -10, CURRENT_TIMESTAMP()), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (7, 2, 3, TIMESTAMPADD(HOUR, 14, CURRENT_TIMESTAMP()), TIMESTAMPADD(HOUR, 16, CURRENT_TIMESTAMP()), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (8, 2, 4, TIMESTAMPADD(HOUR, 15, CURRENT_TIMESTAMP()), TIMESTAMPADD(HOUR, 17, CURRENT_TIMESTAMP()), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (9, 2, 5, TIMESTAMPADD(HOUR, 17, CURRENT_TIMESTAMP()), TIMESTAMPADD(HOUR, 19, CURRENT_TIMESTAMP()), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (10, 2, 6, TIMESTAMPADD(HOUR, 36, CURRENT_TIMESTAMP()), TIMESTAMPADD(HOUR, 38, CURRENT_TIMESTAMP()), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()); + +-- 기생충 상영 스케줄 (진행) +INSERT INTO screening (id, movie_id, theater_id, start_at, end_at, create_at, modify_at) +VALUES + (11, 3, 3, TIMESTAMPADD(HOUR, -10, CURRENT_TIMESTAMP()), TIMESTAMPADD(HOUR, -8, CURRENT_TIMESTAMP()), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (12, 3, 4, TIMESTAMPADD(HOUR, 13, CURRENT_TIMESTAMP()), TIMESTAMPADD(HOUR, 15, CURRENT_TIMESTAMP()), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (13, 3, 5, TIMESTAMPADD(HOUR, 14, CURRENT_TIMESTAMP()), TIMESTAMPADD(HOUR, 16, CURRENT_TIMESTAMP()), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (14, 3, 6, TIMESTAMPADD(HOUR, 18, CURRENT_TIMESTAMP()), TIMESTAMPADD(HOUR, 20, CURRENT_TIMESTAMP()), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (15, 3, 7, TIMESTAMPADD(HOUR, 20, CURRENT_TIMESTAMP()), TIMESTAMPADD(HOUR, 22, CURRENT_TIMESTAMP()), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()); + +-- 인셉션 상영 스케줄 (종료) +INSERT INTO screening (id, movie_id, theater_id, start_at, end_at, create_at, modify_at) +VALUES + (16, 4, 4, TIMESTAMPADD(HOUR, 10, DATEADD('DAY', -100, CURRENT_DATE())), TIMESTAMPADD(HOUR, 12, DATEADD('DAY', -100, CURRENT_DATE())), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (17, 4, 5, TIMESTAMPADD(HOUR, 13, DATEADD('DAY', -100, CURRENT_DATE())), TIMESTAMPADD(HOUR, 15, DATEADD('DAY', -100, CURRENT_DATE())), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()), + (18, 4, 6, TIMESTAMPADD(HOUR, 14, DATEADD('DAY', -100, CURRENT_DATE())), TIMESTAMPADD(HOUR, 16, DATEADD('DAY', -100, CURRENT_DATE())), CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()); diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000..a4b76b953 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000..e2847c820 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100644 index 000000000..f5feea6d6 --- /dev/null +++ b/gradlew @@ -0,0 +1,252 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 000000000..9d21a2183 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,94 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/img.png b/img.png new file mode 100644 index 000000000..cda5fc305 Binary files /dev/null and b/img.png differ diff --git a/img_1.png b/img_1.png new file mode 100644 index 000000000..f3ed88f35 Binary files /dev/null and b/img_1.png differ diff --git a/img_2.png b/img_2.png new file mode 100644 index 000000000..f3ed88f35 Binary files /dev/null and b/img_2.png differ diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 000000000..ce5f41f3b --- /dev/null +++ b/settings.gradle @@ -0,0 +1,4 @@ +rootProject.name = 'multi-modules' +include 'api' +include 'domain' +