diff --git a/.gradle/8.14/checksums/checksums.lock b/.gradle/8.14/checksums/checksums.lock new file mode 100644 index 0000000..f5b7324 Binary files /dev/null and b/.gradle/8.14/checksums/checksums.lock differ diff --git a/.gradle/8.14/checksums/md5-checksums.bin b/.gradle/8.14/checksums/md5-checksums.bin new file mode 100644 index 0000000..bc69892 Binary files /dev/null and b/.gradle/8.14/checksums/md5-checksums.bin differ diff --git a/.gradle/8.14/checksums/sha1-checksums.bin b/.gradle/8.14/checksums/sha1-checksums.bin new file mode 100644 index 0000000..12854d1 Binary files /dev/null and b/.gradle/8.14/checksums/sha1-checksums.bin differ diff --git a/.gradle/8.14/executionHistory/executionHistory.bin b/.gradle/8.14/executionHistory/executionHistory.bin new file mode 100644 index 0000000..92b20ae Binary files /dev/null and b/.gradle/8.14/executionHistory/executionHistory.bin differ diff --git a/.gradle/8.14/executionHistory/executionHistory.lock b/.gradle/8.14/executionHistory/executionHistory.lock new file mode 100644 index 0000000..33a15e6 Binary files /dev/null and b/.gradle/8.14/executionHistory/executionHistory.lock differ diff --git a/.gradle/8.14/fileChanges/last-build.bin b/.gradle/8.14/fileChanges/last-build.bin new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/.gradle/8.14/fileChanges/last-build.bin differ diff --git a/.gradle/8.14/fileHashes/fileHashes.bin b/.gradle/8.14/fileHashes/fileHashes.bin new file mode 100644 index 0000000..f0f5387 Binary files /dev/null and b/.gradle/8.14/fileHashes/fileHashes.bin differ diff --git a/.gradle/8.14/fileHashes/fileHashes.lock b/.gradle/8.14/fileHashes/fileHashes.lock new file mode 100644 index 0000000..1142816 Binary files /dev/null and b/.gradle/8.14/fileHashes/fileHashes.lock differ diff --git a/.gradle/8.14/fileHashes/resourceHashesCache.bin b/.gradle/8.14/fileHashes/resourceHashesCache.bin new file mode 100644 index 0000000..3b67a7b Binary files /dev/null and b/.gradle/8.14/fileHashes/resourceHashesCache.bin differ diff --git a/.gradle/8.14/gc.properties b/.gradle/8.14/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 0000000..5e3cddd Binary files /dev/null and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/.gradle/buildOutputCleanup/cache.properties b/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 0000000..1e38716 --- /dev/null +++ b/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Mon Apr 13 01:51:18 KST 2026 +gradle.version=8.14 diff --git a/.gradle/buildOutputCleanup/outputFiles.bin b/.gradle/buildOutputCleanup/outputFiles.bin new file mode 100644 index 0000000..d15be2b Binary files /dev/null and b/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/.gradle/file-system.probe b/.gradle/file-system.probe new file mode 100644 index 0000000..5906775 Binary files /dev/null and b/.gradle/file-system.probe differ diff --git a/.gradle/vcs-1/gc.properties b/.gradle/vcs-1/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..c3f502a --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# 디폴트 무시된 파일 +/shelf/ +/workspace.xml +# 에디터 기반 HTTP 클라이언트 요청 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..e516cfe --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +umc10th \ No newline at end of file diff --git a/.idea/Spring_Boot.iml b/.idea/Spring_Boot.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/Spring_Boot.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..7cfa737 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml new file mode 100644 index 0000000..47af1f8 --- /dev/null +++ b/.idea/dataSources.xml @@ -0,0 +1,28 @@ + + + + + mysql.8 + true + true + $PROJECT_DIR$/src/main/resources/application.yaml + com.mysql.cj.jdbc.Driver + jdbc:mysql://localhost:3306/umc10th + $ProjectFileDir$ + + + mysql.8 + true + true + $PROJECT_DIR$/src/main/resources/application.yaml + com.mysql.cj.jdbc.Driver + jdbc:mysql://localhost:3306/umc10th + + + + + + $ProjectFileDir$ + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..ce1c62c --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,16 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..f16dea7 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/HELP.md b/HELP.md new file mode 100644 index 0000000..9035108 --- /dev/null +++ b/HELP.md @@ -0,0 +1,28 @@ +# Getting Started + +### Reference Documentation + +For further reference, please consider the following sections: + +* [Official Gradle documentation](https://docs.gradle.org) +* [Spring Boot Gradle Plugin Reference Guide](https://docs.spring.io/spring-boot/4.0.5/gradle-plugin) +* [Create an OCI image](https://docs.spring.io/spring-boot/4.0.5/gradle-plugin/packaging-oci-image.html) +* [Spring Data JPA](https://docs.spring.io/spring-boot/4.0.5/reference/data/sql.html#data.sql.jpa-and-spring-data) +* [Spring Web](https://docs.spring.io/spring-boot/4.0.5/reference/web/servlet.html) + +### Guides + +The following guides illustrate how to use some features concretely: + +* [Accessing Data with JPA](https://spring.io/guides/gs/accessing-data-jpa/) +* [Accessing data with MySQL](https://spring.io/guides/gs/accessing-data-mysql/) +* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/) +* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/) +* [Building REST services with Spring](https://spring.io/guides/tutorials/rest/) + +### Additional Links + +These additional references should also help you: + +* [Gradle Build Scans – insights for your project's build](https://scans.gradle.com#gradle) + diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..763b145 --- /dev/null +++ b/build.gradle @@ -0,0 +1,42 @@ +plugins { + id 'java' + id 'org.springframework.boot' version '4.0.5' + id 'io.spring.dependency-management' version '1.1.7' +} + +group = 'com.example' +version = '0.0.1-SNAPSHOT' +description = 'umc10th' + +java { + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } +} + +repositories { + mavenCentral() +} + +dependencies { + implementation 'org.springframework.boot:spring-boot-starter-data-jpa' + implementation 'org.springframework.boot:spring-boot-starter-webmvc' + implementation 'org.springframework.boot:spring-boot-starter-validation' + compileOnly 'org.projectlombok:lombok' + runtimeOnly 'com.mysql:mysql-connector-j' + annotationProcessor 'org.projectlombok:lombok' + testImplementation 'org.springframework.boot:spring-boot-starter-data-jpa-test' + testImplementation 'org.springframework.boot:spring-boot-starter-webmvc-test' + testCompileOnly 'org.projectlombok:lombok' + testRuntimeOnly 'org.junit.platform:junit-platform-launcher' + testAnnotationProcessor 'org.projectlombok:lombok' + + // Swagger + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:3.0.1' + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-api:3.0.1' + +} + +tasks.named('test') { + useJUnitPlatform() +} diff --git a/build/classes/java/main/com/example/umc10th/Umc10thApplication.class b/build/classes/java/main/com/example/umc10th/Umc10thApplication.class new file mode 100644 index 0000000..2a65d7f Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/Umc10thApplication.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/member/controller/MemberController.class b/build/classes/java/main/com/example/umc10th/domain/member/controller/MemberController.class new file mode 100644 index 0000000..54e85c9 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/member/controller/MemberController.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/member/converter/MemberConverter.class b/build/classes/java/main/com/example/umc10th/domain/member/converter/MemberConverter.class new file mode 100644 index 0000000..cf85f80 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/member/converter/MemberConverter.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/member/dto/MemberReqDTO$JoinDTO.class b/build/classes/java/main/com/example/umc10th/domain/member/dto/MemberReqDTO$JoinDTO.class new file mode 100644 index 0000000..7c643b2 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/member/dto/MemberReqDTO$JoinDTO.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/member/dto/MemberReqDTO.class b/build/classes/java/main/com/example/umc10th/domain/member/dto/MemberReqDTO.class new file mode 100644 index 0000000..d98a96c Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/member/dto/MemberReqDTO.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/member/dto/MemberResDTO$JoinResultDTO$JoinResultDTOBuilder.class b/build/classes/java/main/com/example/umc10th/domain/member/dto/MemberResDTO$JoinResultDTO$JoinResultDTOBuilder.class new file mode 100644 index 0000000..4177780 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/member/dto/MemberResDTO$JoinResultDTO$JoinResultDTOBuilder.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/member/dto/MemberResDTO$JoinResultDTO.class b/build/classes/java/main/com/example/umc10th/domain/member/dto/MemberResDTO$JoinResultDTO.class new file mode 100644 index 0000000..546ebf2 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/member/dto/MemberResDTO$JoinResultDTO.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/member/dto/MemberResDTO$MemberInfoDTO$MemberInfoDTOBuilder.class b/build/classes/java/main/com/example/umc10th/domain/member/dto/MemberResDTO$MemberInfoDTO$MemberInfoDTOBuilder.class new file mode 100644 index 0000000..c868e10 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/member/dto/MemberResDTO$MemberInfoDTO$MemberInfoDTOBuilder.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/member/dto/MemberResDTO$MemberInfoDTO.class b/build/classes/java/main/com/example/umc10th/domain/member/dto/MemberResDTO$MemberInfoDTO.class new file mode 100644 index 0000000..c66794d Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/member/dto/MemberResDTO$MemberInfoDTO.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/member/dto/MemberResDTO$MyPageDTO$MyPageDTOBuilder.class b/build/classes/java/main/com/example/umc10th/domain/member/dto/MemberResDTO$MyPageDTO$MyPageDTOBuilder.class new file mode 100644 index 0000000..4f00c48 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/member/dto/MemberResDTO$MyPageDTO$MyPageDTOBuilder.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/member/dto/MemberResDTO$MyPageDTO.class b/build/classes/java/main/com/example/umc10th/domain/member/dto/MemberResDTO$MyPageDTO.class new file mode 100644 index 0000000..4c2b047 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/member/dto/MemberResDTO$MyPageDTO.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/member/dto/MemberResDTO.class b/build/classes/java/main/com/example/umc10th/domain/member/dto/MemberResDTO.class new file mode 100644 index 0000000..1538ca9 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/member/dto/MemberResDTO.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/member/entity/Member$MemberBuilder.class b/build/classes/java/main/com/example/umc10th/domain/member/entity/Member$MemberBuilder.class new file mode 100644 index 0000000..504bd98 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/member/entity/Member$MemberBuilder.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/member/entity/Member.class b/build/classes/java/main/com/example/umc10th/domain/member/entity/Member.class new file mode 100644 index 0000000..13ad4b7 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/member/entity/Member.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/member/enums/Gender.class b/build/classes/java/main/com/example/umc10th/domain/member/enums/Gender.class new file mode 100644 index 0000000..05119d5 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/member/enums/Gender.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/member/exception/MemberException.class b/build/classes/java/main/com/example/umc10th/domain/member/exception/MemberException.class new file mode 100644 index 0000000..c69a57f Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/member/exception/MemberException.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/member/exception/code/MemberErrorCode.class b/build/classes/java/main/com/example/umc10th/domain/member/exception/code/MemberErrorCode.class new file mode 100644 index 0000000..8b183b0 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/member/exception/code/MemberErrorCode.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/member/exception/code/MemberSuccessCode.class b/build/classes/java/main/com/example/umc10th/domain/member/exception/code/MemberSuccessCode.class new file mode 100644 index 0000000..7332d37 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/member/exception/code/MemberSuccessCode.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/member/repository/MemberRepository.class b/build/classes/java/main/com/example/umc10th/domain/member/repository/MemberRepository.class new file mode 100644 index 0000000..818c632 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/member/repository/MemberRepository.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/member/service/MemberService.class b/build/classes/java/main/com/example/umc10th/domain/member/service/MemberService.class new file mode 100644 index 0000000..a7c78ce Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/member/service/MemberService.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/memberMission/controller/MemberMissionController.class b/build/classes/java/main/com/example/umc10th/domain/memberMission/controller/MemberMissionController.class new file mode 100644 index 0000000..5ae43ec Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/memberMission/controller/MemberMissionController.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/memberMission/dto/MemberMissionReqDTO.class b/build/classes/java/main/com/example/umc10th/domain/memberMission/dto/MemberMissionReqDTO.class new file mode 100644 index 0000000..ea233a4 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/memberMission/dto/MemberMissionReqDTO.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/memberMission/dto/MemberMissionResDTO$MyMissionDTO$MyMissionDTOBuilder.class b/build/classes/java/main/com/example/umc10th/domain/memberMission/dto/MemberMissionResDTO$MyMissionDTO$MyMissionDTOBuilder.class new file mode 100644 index 0000000..873ee8f Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/memberMission/dto/MemberMissionResDTO$MyMissionDTO$MyMissionDTOBuilder.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/memberMission/dto/MemberMissionResDTO$MyMissionDTO.class b/build/classes/java/main/com/example/umc10th/domain/memberMission/dto/MemberMissionResDTO$MyMissionDTO.class new file mode 100644 index 0000000..c50d3c3 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/memberMission/dto/MemberMissionResDTO$MyMissionDTO.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/memberMission/dto/MemberMissionResDTO$MyMissionListDTO$MyMissionListDTOBuilder.class b/build/classes/java/main/com/example/umc10th/domain/memberMission/dto/MemberMissionResDTO$MyMissionListDTO$MyMissionListDTOBuilder.class new file mode 100644 index 0000000..1c853c8 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/memberMission/dto/MemberMissionResDTO$MyMissionListDTO$MyMissionListDTOBuilder.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/memberMission/dto/MemberMissionResDTO$MyMissionListDTO.class b/build/classes/java/main/com/example/umc10th/domain/memberMission/dto/MemberMissionResDTO$MyMissionListDTO.class new file mode 100644 index 0000000..72ad3ef Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/memberMission/dto/MemberMissionResDTO$MyMissionListDTO.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/memberMission/dto/MemberMissionResDTO.class b/build/classes/java/main/com/example/umc10th/domain/memberMission/dto/MemberMissionResDTO.class new file mode 100644 index 0000000..c5323c9 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/memberMission/dto/MemberMissionResDTO.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/memberMission/entity/MemberMission$MemberMissionBuilder.class b/build/classes/java/main/com/example/umc10th/domain/memberMission/entity/MemberMission$MemberMissionBuilder.class new file mode 100644 index 0000000..b6c4ef0 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/memberMission/entity/MemberMission$MemberMissionBuilder.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/memberMission/entity/MemberMission.class b/build/classes/java/main/com/example/umc10th/domain/memberMission/entity/MemberMission.class new file mode 100644 index 0000000..d703566 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/memberMission/entity/MemberMission.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/memberMission/repository/MemberMissionRepository.class b/build/classes/java/main/com/example/umc10th/domain/memberMission/repository/MemberMissionRepository.class new file mode 100644 index 0000000..8a39656 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/memberMission/repository/MemberMissionRepository.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/memberMission/service/MemberMissionService.class b/build/classes/java/main/com/example/umc10th/domain/memberMission/service/MemberMissionService.class new file mode 100644 index 0000000..bb95fc2 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/memberMission/service/MemberMissionService.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/mission/controller/MissionController.class b/build/classes/java/main/com/example/umc10th/domain/mission/controller/MissionController.class new file mode 100644 index 0000000..04d640e Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/mission/controller/MissionController.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/mission/converter/MissionConverter.class b/build/classes/java/main/com/example/umc10th/domain/mission/converter/MissionConverter.class new file mode 100644 index 0000000..553d6bd Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/mission/converter/MissionConverter.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionReqDTO$CreateMissionDTO.class b/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionReqDTO$CreateMissionDTO.class new file mode 100644 index 0000000..3cbf99d Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionReqDTO$CreateMissionDTO.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionReqDTO.class b/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionReqDTO.class new file mode 100644 index 0000000..5c6235a Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionReqDTO.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionResDTO$CreateMissionResultDTO$CreateMissionResultDTOBuilder.class b/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionResDTO$CreateMissionResultDTO$CreateMissionResultDTOBuilder.class new file mode 100644 index 0000000..4f4b8d9 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionResDTO$CreateMissionResultDTO$CreateMissionResultDTOBuilder.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionResDTO$CreateMissionResultDTO.class b/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionResDTO$CreateMissionResultDTO.class new file mode 100644 index 0000000..dddb128 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionResDTO$CreateMissionResultDTO.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionResDTO$HomeMissionDTO$HomeMissionDTOBuilder.class b/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionResDTO$HomeMissionDTO$HomeMissionDTOBuilder.class new file mode 100644 index 0000000..dd8186e Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionResDTO$HomeMissionDTO$HomeMissionDTOBuilder.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionResDTO$HomeMissionDTO.class b/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionResDTO$HomeMissionDTO.class new file mode 100644 index 0000000..4f66ea6 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionResDTO$HomeMissionDTO.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionResDTO$HomeMissionListDTO$HomeMissionListDTOBuilder.class b/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionResDTO$HomeMissionListDTO$HomeMissionListDTOBuilder.class new file mode 100644 index 0000000..96ac34a Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionResDTO$HomeMissionListDTO$HomeMissionListDTOBuilder.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionResDTO$HomeMissionListDTO.class b/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionResDTO$HomeMissionListDTO.class new file mode 100644 index 0000000..1a8f92d Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionResDTO$HomeMissionListDTO.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionResDTO$MissionInfoDTO$MissionInfoDTOBuilder.class b/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionResDTO$MissionInfoDTO$MissionInfoDTOBuilder.class new file mode 100644 index 0000000..1d1348e Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionResDTO$MissionInfoDTO$MissionInfoDTOBuilder.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionResDTO$MissionInfoDTO.class b/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionResDTO$MissionInfoDTO.class new file mode 100644 index 0000000..f5fd49b Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionResDTO$MissionInfoDTO.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionResDTO.class b/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionResDTO.class new file mode 100644 index 0000000..0f95436 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/mission/dto/MissionResDTO.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/mission/entity/Mission$MissionBuilder.class b/build/classes/java/main/com/example/umc10th/domain/mission/entity/Mission$MissionBuilder.class new file mode 100644 index 0000000..2234fe5 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/mission/entity/Mission$MissionBuilder.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/mission/entity/Mission.class b/build/classes/java/main/com/example/umc10th/domain/mission/entity/Mission.class new file mode 100644 index 0000000..b57aa76 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/mission/entity/Mission.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/mission/repository/MissionRepository.class b/build/classes/java/main/com/example/umc10th/domain/mission/repository/MissionRepository.class new file mode 100644 index 0000000..fa584a0 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/mission/repository/MissionRepository.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/mission/service/MissionService.class b/build/classes/java/main/com/example/umc10th/domain/mission/service/MissionService.class new file mode 100644 index 0000000..9358ed8 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/mission/service/MissionService.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/review/controller/ReviewController.class b/build/classes/java/main/com/example/umc10th/domain/review/controller/ReviewController.class new file mode 100644 index 0000000..7b06a72 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/review/controller/ReviewController.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/review/converter/ReviewConverter.class b/build/classes/java/main/com/example/umc10th/domain/review/converter/ReviewConverter.class new file mode 100644 index 0000000..ec555f4 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/review/converter/ReviewConverter.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/review/dto/ReviewReqDTO$CreateReviewDTO.class b/build/classes/java/main/com/example/umc10th/domain/review/dto/ReviewReqDTO$CreateReviewDTO.class new file mode 100644 index 0000000..205b5a3 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/review/dto/ReviewReqDTO$CreateReviewDTO.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/review/dto/ReviewReqDTO.class b/build/classes/java/main/com/example/umc10th/domain/review/dto/ReviewReqDTO.class new file mode 100644 index 0000000..c8a4a2d Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/review/dto/ReviewReqDTO.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/review/dto/ReviewResDTO$CreateReviewResultDTO$CreateReviewResultDTOBuilder.class b/build/classes/java/main/com/example/umc10th/domain/review/dto/ReviewResDTO$CreateReviewResultDTO$CreateReviewResultDTOBuilder.class new file mode 100644 index 0000000..567b22e Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/review/dto/ReviewResDTO$CreateReviewResultDTO$CreateReviewResultDTOBuilder.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/review/dto/ReviewResDTO$CreateReviewResultDTO.class b/build/classes/java/main/com/example/umc10th/domain/review/dto/ReviewResDTO$CreateReviewResultDTO.class new file mode 100644 index 0000000..bdd8df7 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/review/dto/ReviewResDTO$CreateReviewResultDTO.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/review/dto/ReviewResDTO.class b/build/classes/java/main/com/example/umc10th/domain/review/dto/ReviewResDTO.class new file mode 100644 index 0000000..fe2a9d3 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/review/dto/ReviewResDTO.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/review/entity/Review$ReviewBuilder.class b/build/classes/java/main/com/example/umc10th/domain/review/entity/Review$ReviewBuilder.class new file mode 100644 index 0000000..0cc8355 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/review/entity/Review$ReviewBuilder.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/review/entity/Review.class b/build/classes/java/main/com/example/umc10th/domain/review/entity/Review.class new file mode 100644 index 0000000..16f95c6 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/review/entity/Review.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/review/repository/ReviewRepository.class b/build/classes/java/main/com/example/umc10th/domain/review/repository/ReviewRepository.class new file mode 100644 index 0000000..88965aa Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/review/repository/ReviewRepository.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/review/service/ReviewService.class b/build/classes/java/main/com/example/umc10th/domain/review/service/ReviewService.class new file mode 100644 index 0000000..d35977a Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/review/service/ReviewService.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/store/entity/Location$LocationBuilder.class b/build/classes/java/main/com/example/umc10th/domain/store/entity/Location$LocationBuilder.class new file mode 100644 index 0000000..7a24231 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/store/entity/Location$LocationBuilder.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/store/entity/Location.class b/build/classes/java/main/com/example/umc10th/domain/store/entity/Location.class new file mode 100644 index 0000000..9ecc986 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/store/entity/Location.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/store/entity/Store$StoreBuilder.class b/build/classes/java/main/com/example/umc10th/domain/store/entity/Store$StoreBuilder.class new file mode 100644 index 0000000..ab5a1a9 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/store/entity/Store$StoreBuilder.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/store/entity/Store.class b/build/classes/java/main/com/example/umc10th/domain/store/entity/Store.class new file mode 100644 index 0000000..144e9b7 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/store/entity/Store.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/store/repository/LocationRepository.class b/build/classes/java/main/com/example/umc10th/domain/store/repository/LocationRepository.class new file mode 100644 index 0000000..321c8eb Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/store/repository/LocationRepository.class differ diff --git a/build/classes/java/main/com/example/umc10th/domain/store/repository/StoreRepository.class b/build/classes/java/main/com/example/umc10th/domain/store/repository/StoreRepository.class new file mode 100644 index 0000000..abd9957 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/domain/store/repository/StoreRepository.class differ diff --git a/build/classes/java/main/com/example/umc10th/global/apiPayload/ApiResponse.class b/build/classes/java/main/com/example/umc10th/global/apiPayload/ApiResponse.class new file mode 100644 index 0000000..d0d4b6e Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/global/apiPayload/ApiResponse.class differ diff --git a/build/classes/java/main/com/example/umc10th/global/apiPayload/code/BaseErrorCode.class b/build/classes/java/main/com/example/umc10th/global/apiPayload/code/BaseErrorCode.class new file mode 100644 index 0000000..064487d Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/global/apiPayload/code/BaseErrorCode.class differ diff --git a/build/classes/java/main/com/example/umc10th/global/apiPayload/code/BaseSuccessCode.class b/build/classes/java/main/com/example/umc10th/global/apiPayload/code/BaseSuccessCode.class new file mode 100644 index 0000000..30c85b0 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/global/apiPayload/code/BaseSuccessCode.class differ diff --git a/build/classes/java/main/com/example/umc10th/global/apiPayload/code/GeneralErrorCode.class b/build/classes/java/main/com/example/umc10th/global/apiPayload/code/GeneralErrorCode.class new file mode 100644 index 0000000..83ddb2c Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/global/apiPayload/code/GeneralErrorCode.class differ diff --git a/build/classes/java/main/com/example/umc10th/global/apiPayload/code/GeneralSuccessCode.class b/build/classes/java/main/com/example/umc10th/global/apiPayload/code/GeneralSuccessCode.class new file mode 100644 index 0000000..1bca54a Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/global/apiPayload/code/GeneralSuccessCode.class differ diff --git a/build/classes/java/main/com/example/umc10th/global/apiPayload/exception/ProjectException.class b/build/classes/java/main/com/example/umc10th/global/apiPayload/exception/ProjectException.class new file mode 100644 index 0000000..d781cd5 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/global/apiPayload/exception/ProjectException.class differ diff --git a/build/classes/java/main/com/example/umc10th/global/config/SwaggerConfig.class b/build/classes/java/main/com/example/umc10th/global/config/SwaggerConfig.class new file mode 100644 index 0000000..6ce26c9 Binary files /dev/null and b/build/classes/java/main/com/example/umc10th/global/config/SwaggerConfig.class differ diff --git a/build/reports/problems/problems-report.html b/build/reports/problems/problems-report.html new file mode 100644 index 0000000..158fd51 --- /dev/null +++ b/build/reports/problems/problems-report.html @@ -0,0 +1,663 @@ + + + + + + + + + + + + + Gradle Configuration Cache + + + +
+ +
+ Loading... +
+ + + + + + diff --git a/build/resources/main/application.yml b/build/resources/main/application.yml new file mode 100644 index 0000000..5acd671 --- /dev/null +++ b/build/resources/main/application.yml @@ -0,0 +1,16 @@ +spring: + datasource: + url: jdbc:mysql://localhost:3306/umc10th + username: root + password: 1s404s0705@@ + driver-class-name: com.mysql.cj.jdbc.Driver + + jpa: + hibernate: + ddl-auto: update + + show-sql: true + + properties: + hibernate: + format_sql: true \ No newline at end of file diff --git a/build/tmp/compileJava/previous-compilation-data.bin b/build/tmp/compileJava/previous-compilation-data.bin new file mode 100644 index 0000000..4ebb398 Binary files /dev/null and b/build/tmp/compileJava/previous-compilation-data.bin differ diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..1b33c55 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 0000000..ca025c8 --- /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.14-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..23d15a9 --- /dev/null +++ b/gradlew @@ -0,0 +1,251 @@ +#!/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\n' "$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="\\\"\\\"" + + +# 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, 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" \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ + "$@" + +# 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 0000000..db3a6ac --- /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= + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* + +: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/settings.gradle b/settings.gradle new file mode 100644 index 0000000..67a1b8e --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'umc10th' diff --git a/src/main/java/com/example/umc10th/Umc10thApplication.java b/src/main/java/com/example/umc10th/Umc10thApplication.java new file mode 100644 index 0000000..c6bad04 --- /dev/null +++ b/src/main/java/com/example/umc10th/Umc10thApplication.java @@ -0,0 +1,14 @@ +package com.example.umc10th; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.data.jpa.repository.config.EnableJpaAuditing; + +@EnableJpaAuditing +@SpringBootApplication +public class Umc10thApplication { + + public static void main(String[] args) { + SpringApplication.run(Umc10thApplication.class, args); + } +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/domain/member/controller/MemberController.java b/src/main/java/com/example/umc10th/domain/member/controller/MemberController.java new file mode 100644 index 0000000..1853606 --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/member/controller/MemberController.java @@ -0,0 +1,57 @@ +package com.example.umc10th.domain.member.controller; + +import com.example.umc10th.domain.member.dto.MemberReqDTO; +import com.example.umc10th.domain.member.dto.MemberResDTO; +import com.example.umc10th.domain.member.exception.code.MemberSuccessCode; +import com.example.umc10th.domain.member.service.MemberService; +import com.example.umc10th.global.apiPayload.ApiResponse; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/members") +public class MemberController { + + private final MemberService memberService; + + @PostMapping + public ApiResponse joinMember( + @RequestBody MemberReqDTO.JoinDTO request + ) { + return ApiResponse.onSuccess( + MemberSuccessCode.MEMBER_CREATED, + memberService.joinMember(request) + ); + } + + @GetMapping("/{memberId}") + public ApiResponse getMember( + @PathVariable Long memberId + ) { + return ApiResponse.onSuccess( + MemberSuccessCode.MEMBER_FOUND, + memberService.getMember(memberId) + ); + } + + @GetMapping("/{memberId}/my-page") + public ApiResponse getMyPage( + @PathVariable Long memberId + ) { + return ApiResponse.onSuccess( + MemberSuccessCode.MY_PAGE_FOUND, + memberService.getMyPage(memberId) + ); + } + + @DeleteMapping("/{memberId}") + public ApiResponse deleteMember( + @PathVariable Long memberId + ) { + return ApiResponse.onSuccess( + MemberSuccessCode.MEMBER_DELETED, + memberService.deleteMember(memberId) + ); + } +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/domain/member/converter/MemberConverter.java b/src/main/java/com/example/umc10th/domain/member/converter/MemberConverter.java new file mode 100644 index 0000000..e843bd6 --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/member/converter/MemberConverter.java @@ -0,0 +1,42 @@ +package com.example.umc10th.domain.member.converter; + +import com.example.umc10th.domain.member.dto.MemberReqDTO; +import com.example.umc10th.domain.member.dto.MemberResDTO; +import com.example.umc10th.domain.member.entity.Member; + +public class MemberConverter { + + public static Member toMember(MemberReqDTO.JoinDTO request) { + return Member.builder() + .email(request.email()) + .password(request.password()) + .nickname(request.nickname()) + .phoneNumber(request.phoneNumber()) + .gender(request.gender()) + .birth(request.birth()) + .point(0) + .build(); + } + + public static MemberResDTO.JoinResultDTO toJoinResultDTO(Member member) { + return MemberResDTO.JoinResultDTO.builder() + .memberId(member.getId()) + .email(member.getEmail()) + .nickname(member.getNickname()) + .createdAt(member.getCreatedAt()) + .build(); + } + + public static MemberResDTO.MemberInfoDTO toMemberInfoDTO(Member member) { + return MemberResDTO.MemberInfoDTO.builder() + .memberId(member.getId()) + .email(member.getEmail()) + .nickname(member.getNickname()) + .phoneNumber(member.getPhoneNumber()) + .gender(member.getGender()) + .birth(member.getBirth()) + .point(member.getPoint()) + .createdAt(member.getCreatedAt()) + .build(); + } +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/domain/member/dto/MemberReqDTO.java b/src/main/java/com/example/umc10th/domain/member/dto/MemberReqDTO.java new file mode 100644 index 0000000..a885082 --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/member/dto/MemberReqDTO.java @@ -0,0 +1,18 @@ +package com.example.umc10th.domain.member.dto; + +import com.example.umc10th.domain.member.enums.Gender; + +import java.time.LocalDate; + +public class MemberReqDTO { + + public record JoinDTO( + String email, + String password, + String nickname, + String phoneNumber, + Gender gender, + LocalDate birth + ) { + } +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/domain/member/dto/MemberResDTO.java b/src/main/java/com/example/umc10th/domain/member/dto/MemberResDTO.java new file mode 100644 index 0000000..804fe50 --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/member/dto/MemberResDTO.java @@ -0,0 +1,42 @@ +package com.example.umc10th.domain.member.dto; + +import com.example.umc10th.domain.member.enums.Gender; +import lombok.Builder; + +import java.time.LocalDate; +import java.time.LocalDateTime; + +public class MemberResDTO { + + @Builder + public record JoinResultDTO( + Long memberId, + String email, + String nickname, + LocalDateTime createdAt + ) { + } + + @Builder + public record MemberInfoDTO( + Long memberId, + String email, + String nickname, + String phoneNumber, + Gender gender, + LocalDate birth, + Integer point, + LocalDateTime createdAt + ) { + } + + @Builder + public record MyPageDTO( + Long memberId, + String nickname, + String email, + Integer point, + Long reviewCount + ) { + } +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/domain/member/entity/Member.java b/src/main/java/com/example/umc10th/domain/member/entity/Member.java new file mode 100644 index 0000000..5fef557 --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/member/entity/Member.java @@ -0,0 +1,49 @@ +package com.example.umc10th.domain.member.entity; + +import com.example.umc10th.domain.member.enums.Gender; +import com.example.umc10th.domain.review.entity.Review; +import com.example.umc10th.global.entity.BaseEntity; +import jakarta.persistence.*; +import lombok.*; + +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.List; + +@Entity +@Getter +@Builder +@AllArgsConstructor +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@Table(name = "member") +public class Member { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "member_id") + private Long id; + + private String email; + + private String password; + + private String nickname; + + @Column(name = "phone_number") + private String phoneNumber; + + @Enumerated(EnumType.STRING) + private Gender gender; + + private LocalDate birth; + + private Integer point; + + @OneToMany(mappedBy = "member") + private List reviewList = new ArrayList<>(); + + @PrePersist + public void prePersist() { + this.point = this.point == null ? 0 : this.point; + } +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/domain/member/enums/Gender.java b/src/main/java/com/example/umc10th/domain/member/enums/Gender.java new file mode 100644 index 0000000..8d67737 --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/member/enums/Gender.java @@ -0,0 +1,6 @@ +package com.example.umc10th.domain.member.enums; + +public enum Gender { + MALE, + FEMALE +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/domain/member/exception/MemberException.java b/src/main/java/com/example/umc10th/domain/member/exception/MemberException.java new file mode 100644 index 0000000..c10a1fd --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/member/exception/MemberException.java @@ -0,0 +1,11 @@ +package com.example.umc10th.domain.member.exception; + +import com.example.umc10th.global.apiPayload.code.BaseErrorCode; +import com.example.umc10th.global.apiPayload.exception.ProjectException; + +public class MemberException extends ProjectException { + + public MemberException(BaseErrorCode errorCode) { + super(errorCode); + } +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/domain/member/exception/code/MemberErrorCode.java b/src/main/java/com/example/umc10th/domain/member/exception/code/MemberErrorCode.java new file mode 100644 index 0000000..477e0c1 --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/member/exception/code/MemberErrorCode.java @@ -0,0 +1,21 @@ +package com.example.umc10th.domain.member.exception.code; + +import com.example.umc10th.global.apiPayload.code.BaseErrorCode; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +@Getter +@RequiredArgsConstructor +public enum MemberErrorCode implements BaseErrorCode { + + MEMBER_NOT_FOUND( + HttpStatus.NOT_FOUND, + "MEMBER404_1", + "해당 사용자를 찾을 수 없습니다." + ); + + private final HttpStatus status; + private final String code; + private final String message; +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/domain/member/exception/code/MemberSuccessCode.java b/src/main/java/com/example/umc10th/domain/member/exception/code/MemberSuccessCode.java new file mode 100644 index 0000000..668d2dd --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/member/exception/code/MemberSuccessCode.java @@ -0,0 +1,36 @@ +package com.example.umc10th.domain.member.exception.code; + +import com.example.umc10th.global.apiPayload.code.BaseSuccessCode; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +@Getter +@RequiredArgsConstructor +public enum MemberSuccessCode implements BaseSuccessCode { + + MEMBER_CREATED( + HttpStatus.CREATED, + "MEMBER201_1", + "회원 가입이 성공적으로 완료되었습니다." + ), + MEMBER_FOUND( + HttpStatus.OK, + "MEMBER200_1", + "성공적으로 회원을 조회했습니다." + ), + MY_PAGE_FOUND( + HttpStatus.OK, + "MEMBER200_2", + "마이페이지를 성공적으로 조회했습니다." + ), + MEMBER_DELETED( + HttpStatus.OK, + "MEMBER200_3", + "회원 탈퇴가 성공적으로 처리되었습니다." + ); + + private final HttpStatus status; + private final String code; + private final String message; +} diff --git a/src/main/java/com/example/umc10th/domain/member/repository/MemberRepository.java b/src/main/java/com/example/umc10th/domain/member/repository/MemberRepository.java new file mode 100644 index 0000000..249dfeb --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/member/repository/MemberRepository.java @@ -0,0 +1,20 @@ +package com.example.umc10th.domain.member.repository; + +import com.example.umc10th.domain.member.entity.Member; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +public interface MemberRepository extends JpaRepository { + + boolean existsByEmail(String email); + + void deleteByEmail(String email); + + @Query(""" + select count(r) + from Review r + where r.member.id = :memberId + """) + Long countReviewByMemberId(@Param("memberId") Long memberId); +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/domain/member/service/MemberService.java b/src/main/java/com/example/umc10th/domain/member/service/MemberService.java new file mode 100644 index 0000000..0945381 --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/member/service/MemberService.java @@ -0,0 +1,65 @@ +package com.example.umc10th.domain.member.service; + +import com.example.umc10th.domain.member.converter.MemberConverter; +import com.example.umc10th.domain.member.dto.MemberReqDTO; +import com.example.umc10th.domain.member.dto.MemberResDTO; +import com.example.umc10th.domain.member.entity.Member; +import com.example.umc10th.domain.member.exception.MemberException; +import com.example.umc10th.domain.member.exception.code.MemberErrorCode; +import com.example.umc10th.domain.member.repository.MemberRepository; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@RequiredArgsConstructor +@Transactional(readOnly = true) +public class MemberService { + + private final MemberRepository memberRepository; + + @Transactional + public MemberResDTO.JoinResultDTO joinMember(MemberReqDTO.JoinDTO request) { + + Member member = MemberConverter.toMember(request); + + Member savedMember = memberRepository.save(member); + + return MemberConverter.toJoinResultDTO(savedMember); + } + + public MemberResDTO.MemberInfoDTO getMember(Long memberId) { + + Member member = memberRepository.findById(memberId) + .orElseThrow(() -> new MemberException(MemberErrorCode.MEMBER_NOT_FOUND)); + + return MemberConverter.toMemberInfoDTO(member); + } + + public MemberResDTO.MyPageDTO getMyPage(Long memberId) { + + Member member = memberRepository.findById(memberId) + .orElseThrow(() -> new MemberException(MemberErrorCode.MEMBER_NOT_FOUND)); + + Long reviewCount = memberRepository.countReviewByMemberId(memberId); + + return MemberResDTO.MyPageDTO.builder() + .memberId(member.getId()) + .nickname(member.getNickname()) + .email(member.getEmail()) + .point(member.getPoint()) + .reviewCount(reviewCount) + .build(); + } + + @Transactional + public String deleteMember(Long memberId) { + + Member member = memberRepository.findById(memberId) + .orElseThrow(() -> new MemberException(MemberErrorCode.MEMBER_NOT_FOUND)); + + memberRepository.delete(member); + + return "OK"; + } +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/domain/memberMission/controller/MemberMissionController.java b/src/main/java/com/example/umc10th/domain/memberMission/controller/MemberMissionController.java new file mode 100644 index 0000000..345bcd1 --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/memberMission/controller/MemberMissionController.java @@ -0,0 +1,42 @@ +package com.example.umc10th.domain.memberMission.controller; + +import com.example.umc10th.domain.memberMission.dto.MemberMissionReqDTO; +import com.example.umc10th.domain.memberMission.dto.MemberMissionResDTO; +import com.example.umc10th.domain.memberMission.exception.code.MemberMissionSuccessCode; +import com.example.umc10th.domain.memberMission.service.MemberMissionService; +import com.example.umc10th.global.apiPayload.ApiResponse; +import jakarta.validation.Valid; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/members") +public class MemberMissionController { + + private final MemberMissionService memberMissionService; + + /** 진행 중인 미션 조회 (오프셋, 회원 ID는 Request Body) */ + @PostMapping("/missions/ongoing") + public ApiResponse getOngoingMissions( + @RequestBody @Valid MemberMissionReqDTO.OngoingMissionsQuery request + ) { + return ApiResponse.onSuccess( + MemberMissionSuccessCode.MY_MISSION_FOUND, + memberMissionService.getOngoingMissions(request) + ); + } + + @GetMapping("/{memberId}/missions") + public ApiResponse getMyMissions( + @PathVariable Long memberId, + @RequestParam Boolean isComplete, + @RequestParam(defaultValue = "0") Integer page, + @RequestParam(defaultValue = "10") Integer pageSize + ) { + return ApiResponse.onSuccess( + MemberMissionSuccessCode.MY_MISSION_FOUND, + memberMissionService.getMyMissions(memberId, isComplete, page, pageSize) + ); + } +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/domain/memberMission/dto/MemberMissionReqDTO.java b/src/main/java/com/example/umc10th/domain/memberMission/dto/MemberMissionReqDTO.java new file mode 100644 index 0000000..bcbddab --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/memberMission/dto/MemberMissionReqDTO.java @@ -0,0 +1,23 @@ +package com.example.umc10th.domain.memberMission.dto; + +import jakarta.validation.constraints.Max; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotNull; + +public class MemberMissionReqDTO { + + /** 진행 중인 미션 조회 (오프셋 페이지네이션) */ + public record OngoingMissionsQuery( + @NotNull(message = "회원 ID는 필수입니다.") + Long memberId, + @NotNull(message = "페이지 번호는 필수입니다.") + @Min(value = 0, message = "페이지 번호는 0 이상이어야 합니다.") + Integer page, + @NotNull(message = "페이지 크기는 필수입니다.") + @Min(value = 1, message = "페이지 크기는 1 이상이어야 합니다.") + @Max(value = 100, message = "페이지 크기는 100 이하여야 합니다.") + Integer pageSize + ) { + } +} + diff --git a/src/main/java/com/example/umc10th/domain/memberMission/dto/MemberMissionResDTO.java b/src/main/java/com/example/umc10th/domain/memberMission/dto/MemberMissionResDTO.java new file mode 100644 index 0000000..ddf8e20 --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/memberMission/dto/MemberMissionResDTO.java @@ -0,0 +1,32 @@ +package com.example.umc10th.domain.memberMission.dto; + +import lombok.Builder; + +import java.time.LocalDateTime; +import java.util.List; + +public class MemberMissionResDTO { + + @Builder + public record MyMissionDTO( + Long memberMissionId, + Long missionId, + String storeName, + String missionTitle, + String missionDescription, + Boolean isComplete, + LocalDateTime completedAt + ) { + } + + @Builder + public record MyMissionListDTO( + List missionList, + Integer listSize, + Integer totalPage, + Long totalElements, + Boolean isFirst, + Boolean isLast + ) { + } +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/domain/memberMission/entity/MemberMission.java b/src/main/java/com/example/umc10th/domain/memberMission/entity/MemberMission.java new file mode 100644 index 0000000..fb045d1 --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/memberMission/entity/MemberMission.java @@ -0,0 +1,36 @@ +package com.example.umc10th.domain.memberMission.entity; + +import com.example.umc10th.domain.member.entity.Member; +import com.example.umc10th.domain.mission.entity.Mission; +import jakarta.persistence.*; +import lombok.*; + +import java.time.LocalDateTime; + +@Entity +@Getter +@Builder +@AllArgsConstructor +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@Table(name = "member_mission") +public class MemberMission { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "member_mission_id") + private Long id; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "member_id") + private Member member; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "mission_id") + private Mission mission; + + @Column(name = "is_complete") + private Boolean isComplete; + + @Column(name = "completed_at") + private LocalDateTime completedAt; +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/domain/memberMission/exception/code/MemberMissionSuccessCode.java b/src/main/java/com/example/umc10th/domain/memberMission/exception/code/MemberMissionSuccessCode.java new file mode 100644 index 0000000..5766a7a --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/memberMission/exception/code/MemberMissionSuccessCode.java @@ -0,0 +1,21 @@ +package com.example.umc10th.domain.memberMission.exception.code; + +import com.example.umc10th.global.apiPayload.code.BaseSuccessCode; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +@Getter +@RequiredArgsConstructor +public enum MemberMissionSuccessCode implements BaseSuccessCode { + + MY_MISSION_FOUND( + HttpStatus.OK, + "MEMBER_MISSION200_1", + "내 미션 목록을 성공적으로 조회했습니다." + ); + + private final HttpStatus status; + private final String code; + private final String message; +} diff --git a/src/main/java/com/example/umc10th/domain/memberMission/repository/MemberMissionRepository.java b/src/main/java/com/example/umc10th/domain/memberMission/repository/MemberMissionRepository.java new file mode 100644 index 0000000..c4a420f --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/memberMission/repository/MemberMissionRepository.java @@ -0,0 +1,33 @@ +package com.example.umc10th.domain.memberMission.repository; + +import com.example.umc10th.domain.memberMission.entity.MemberMission; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +public interface MemberMissionRepository extends JpaRepository { + + @Query( + value = """ + select mm + from MemberMission mm + join fetch mm.mission m + join fetch m.store s + where mm.member.id = :memberId + and mm.isComplete = :isComplete + """, + countQuery = """ + select count(mm) + from MemberMission mm + where mm.member.id = :memberId + and mm.isComplete = :isComplete + """ + ) + Page findMyMissions( + @Param("memberId") Long memberId, + @Param("isComplete") Boolean isComplete, + Pageable pageable + ); +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/domain/memberMission/service/MemberMissionService.java b/src/main/java/com/example/umc10th/domain/memberMission/service/MemberMissionService.java new file mode 100644 index 0000000..64dab1f --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/memberMission/service/MemberMissionService.java @@ -0,0 +1,72 @@ +package com.example.umc10th.domain.memberMission.service; + +import com.example.umc10th.domain.memberMission.dto.MemberMissionResDTO; +import com.example.umc10th.domain.memberMission.entity.MemberMission; +import com.example.umc10th.domain.memberMission.repository.MemberMissionRepository; +import com.example.umc10th.domain.memberMission.dto.MemberMissionReqDTO; +import lombok.RequiredArgsConstructor; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Sort; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +@Service +@RequiredArgsConstructor +@Transactional(readOnly = true) +public class MemberMissionService { + + private final MemberMissionRepository memberMissionRepository; + + public MemberMissionResDTO.MyMissionListDTO getOngoingMissions( + MemberMissionReqDTO.OngoingMissionsQuery request + ) { + return getMyMissions( + request.memberId(), + false, + request.page(), + request.pageSize() + ); + } + + public MemberMissionResDTO.MyMissionListDTO getMyMissions( + Long memberId, + Boolean isComplete, + Integer page, + Integer pageSize + ) { + PageRequest pageRequest = + PageRequest.of(page, pageSize, Sort.by("id").descending()); + + Page memberMissionPage = + memberMissionRepository.findMyMissions( + memberId, + isComplete, + pageRequest + ); + + List missionList = + memberMissionPage.stream() + .map(memberMission -> MemberMissionResDTO.MyMissionDTO.builder() + .memberMissionId(memberMission.getId()) + .missionId(memberMission.getMission().getId()) + .storeName(memberMission.getMission().getStore().getName()) + .missionTitle(memberMission.getMission().getTitle()) + .missionDescription(memberMission.getMission().getDescription()) + .isComplete(memberMission.getIsComplete()) + .completedAt(memberMission.getCompletedAt()) + .build()) + .toList(); + + return MemberMissionResDTO.MyMissionListDTO.builder() + .missionList(missionList) + .listSize(missionList.size()) + .totalPage(memberMissionPage.getTotalPages()) + .totalElements(memberMissionPage.getTotalElements()) + .isFirst(memberMissionPage.isFirst()) + .isLast(memberMissionPage.isLast()) + .build(); + } +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/domain/mission/controller/MissionController.java b/src/main/java/com/example/umc10th/domain/mission/controller/MissionController.java new file mode 100644 index 0000000..fdb8d58 --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/mission/controller/MissionController.java @@ -0,0 +1,48 @@ +package com.example.umc10th.domain.mission.controller; + +import com.example.umc10th.domain.mission.dto.MissionReqDTO; +import com.example.umc10th.domain.mission.dto.MissionResDTO; +import com.example.umc10th.domain.mission.exception.code.MissionSuccessCode; +import com.example.umc10th.domain.mission.service.MissionService; +import com.example.umc10th.global.apiPayload.ApiResponse; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/missions") +public class MissionController { + + private final MissionService missionService; + + @PostMapping + public ApiResponse createMission( + @RequestBody MissionReqDTO.CreateMissionDTO request + ) { + return ApiResponse.onSuccess( + MissionSuccessCode.MISSION_CREATED, + missionService.createMission(request) + ); + } + + @GetMapping("/{missionId}") + public ApiResponse getMission( + @PathVariable Long missionId + ) { + return ApiResponse.onSuccess( + MissionSuccessCode.MISSION_FOUND, + missionService.getMission(missionId) + ); + } + + @GetMapping("/home") + public ApiResponse getHomeMissions( + @RequestParam Long locationId, + @RequestParam(defaultValue = "0") Integer page + ) { + return ApiResponse.onSuccess( + MissionSuccessCode.HOME_MISSION_FOUND, + missionService.getHomeMissions(locationId, page) + ); + } +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/domain/mission/converter/MissionConverter.java b/src/main/java/com/example/umc10th/domain/mission/converter/MissionConverter.java new file mode 100644 index 0000000..f5ef7c4 --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/mission/converter/MissionConverter.java @@ -0,0 +1,44 @@ +package com.example.umc10th.domain.mission.converter; + +import com.example.umc10th.domain.mission.dto.MissionReqDTO; +import com.example.umc10th.domain.mission.dto.MissionResDTO; +import com.example.umc10th.domain.mission.entity.Mission; +import com.example.umc10th.domain.store.entity.Store; + +public class MissionConverter { + + public static Mission toMission( + MissionReqDTO.CreateMissionDTO request, + Store store + ) { + + return Mission.builder() + .store(store) + .title(request.title()) + .description(request.description()) + .build(); + } + + public static MissionResDTO.CreateMissionResultDTO toCreateMissionResultDTO( + Mission mission + ) { + + return MissionResDTO.CreateMissionResultDTO.builder() + .missionId(mission.getId()) + .title(mission.getTitle()) + .description(mission.getDescription()) + .createdAt(mission.getCreatedAt()) + .build(); + } + + public static MissionResDTO.MissionInfoDTO toMissionInfoDTO( + Mission mission + ) { + + return MissionResDTO.MissionInfoDTO.builder() + .missionId(mission.getId()) + .title(mission.getTitle()) + .description(mission.getDescription()) + .build(); + } +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/domain/mission/dto/MissionReqDTO.java b/src/main/java/com/example/umc10th/domain/mission/dto/MissionReqDTO.java new file mode 100644 index 0000000..fad60bc --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/mission/dto/MissionReqDTO.java @@ -0,0 +1,11 @@ +package com.example.umc10th.domain.mission.dto; + +public class MissionReqDTO { + + public record CreateMissionDTO( + Long storeId, + String title, + String description + ) { + } +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/domain/mission/dto/MissionResDTO.java b/src/main/java/com/example/umc10th/domain/mission/dto/MissionResDTO.java new file mode 100644 index 0000000..e7b17c0 --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/mission/dto/MissionResDTO.java @@ -0,0 +1,46 @@ +package com.example.umc10th.domain.mission.dto; + +import lombok.Builder; + +import java.time.LocalDateTime; +import java.util.List; + +public class MissionResDTO { + + @Builder + public record CreateMissionResultDTO( + Long missionId, + String title, + String description, + LocalDateTime createdAt + ) { + } + + @Builder + public record MissionInfoDTO( + Long missionId, + String title, + String description + ) { + } + + @Builder + public record HomeMissionDTO( + Long missionId, + String storeName, + String missionTitle, + String missionDescription + ) { + } + + @Builder + public record HomeMissionListDTO( + List missionList, + Integer listSize, + Integer totalPage, + Long totalElements, + Boolean isFirst, + Boolean isLast + ) { + } +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/domain/mission/entity/Mission.java b/src/main/java/com/example/umc10th/domain/mission/entity/Mission.java new file mode 100644 index 0000000..00516eb --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/mission/entity/Mission.java @@ -0,0 +1,29 @@ +package com.example.umc10th.domain.mission.entity; + +import com.example.umc10th.domain.store.entity.Store; +import com.example.umc10th.global.entity.BaseEntity; +import jakarta.persistence.*; +import lombok.*; + +@Entity +@Getter +@Builder +@AllArgsConstructor +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@Table(name = "mission") +public class Mission extends BaseEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "mission_id") + private Long id; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "store_id") + private Store store; + + private String title; + + @Column(columnDefinition = "TEXT") + private String description; +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/domain/mission/exception/code/MissionSuccessCode.java b/src/main/java/com/example/umc10th/domain/mission/exception/code/MissionSuccessCode.java new file mode 100644 index 0000000..23f86aa --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/mission/exception/code/MissionSuccessCode.java @@ -0,0 +1,31 @@ +package com.example.umc10th.domain.mission.exception.code; + +import com.example.umc10th.global.apiPayload.code.BaseSuccessCode; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +@Getter +@RequiredArgsConstructor +public enum MissionSuccessCode implements BaseSuccessCode { + + MISSION_CREATED( + HttpStatus.CREATED, + "MISSION201_1", + "미션이 성공적으로 생성되었습니다." + ), + MISSION_FOUND( + HttpStatus.OK, + "MISSION200_1", + "성공적으로 미션을 조회했습니다." + ), + HOME_MISSION_FOUND( + HttpStatus.OK, + "MISSION200_2", + "홈 미션 목록을 성공적으로 조회했습니다." + ); + + private final HttpStatus status; + private final String code; + private final String message; +} diff --git a/src/main/java/com/example/umc10th/domain/mission/repository/MissionRepository.java b/src/main/java/com/example/umc10th/domain/mission/repository/MissionRepository.java new file mode 100644 index 0000000..69138fc --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/mission/repository/MissionRepository.java @@ -0,0 +1,32 @@ +package com.example.umc10th.domain.mission.repository; + +import com.example.umc10th.domain.mission.entity.Mission; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +public interface MissionRepository extends JpaRepository { + + @Query( + value = """ + select m + from Mission m + join fetch m.store s + join fetch s.location l + where l.id = :locationId + """, + countQuery = """ + select count(m) + from Mission m + join m.store s + join s.location l + where l.id = :locationId + """ + ) + Page findMissionsByLocation( + @Param("locationId") Long locationId, + Pageable pageable + ); +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/domain/mission/service/MissionService.java b/src/main/java/com/example/umc10th/domain/mission/service/MissionService.java new file mode 100644 index 0000000..e5d8c25 --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/mission/service/MissionService.java @@ -0,0 +1,73 @@ +package com.example.umc10th.domain.mission.service; + +import com.example.umc10th.domain.mission.converter.MissionConverter; +import com.example.umc10th.domain.mission.dto.MissionReqDTO; +import com.example.umc10th.domain.mission.dto.MissionResDTO; +import com.example.umc10th.domain.mission.entity.Mission; +import com.example.umc10th.domain.mission.repository.MissionRepository; +import com.example.umc10th.domain.store.entity.Store; +import com.example.umc10th.domain.store.repository.StoreRepository; +import lombok.RequiredArgsConstructor; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +@Service +@RequiredArgsConstructor +@Transactional(readOnly = true) +public class MissionService { + + private final MissionRepository missionRepository; + private final StoreRepository storeRepository; + + @Transactional + public MissionResDTO.CreateMissionResultDTO createMission( + MissionReqDTO.CreateMissionDTO request + ) { + Store store = storeRepository.findById(request.storeId()) + .orElseThrow(); + + Mission mission = MissionConverter.toMission(request, store); + Mission savedMission = missionRepository.save(mission); + + return MissionConverter.toCreateMissionResultDTO(savedMission); + } + + public MissionResDTO.MissionInfoDTO getMission(Long missionId) { + Mission mission = missionRepository.findById(missionId) + .orElseThrow(); + + return MissionConverter.toMissionInfoDTO(mission); + } + + public MissionResDTO.HomeMissionListDTO getHomeMissions( + Long locationId, + Integer page + ) { + Page missionPage = missionRepository.findMissionsByLocation( + locationId, + PageRequest.of(page, 10) + ); + + List missionList = missionPage.stream() + .map(mission -> MissionResDTO.HomeMissionDTO.builder() + .missionId(mission.getId()) + .storeName(mission.getStore().getName()) + .missionTitle(mission.getTitle()) + .missionDescription(mission.getDescription()) + .build()) + .toList(); + + return MissionResDTO.HomeMissionListDTO.builder() + .missionList(missionList) + .listSize(missionList.size()) + .totalPage(missionPage.getTotalPages()) + .totalElements(missionPage.getTotalElements()) + .isFirst(missionPage.isFirst()) + .isLast(missionPage.isLast()) + .build(); + } +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/domain/review/controller/ReviewController.java b/src/main/java/com/example/umc10th/domain/review/controller/ReviewController.java new file mode 100644 index 0000000..3f5835a --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/review/controller/ReviewController.java @@ -0,0 +1,47 @@ +package com.example.umc10th.domain.review.controller; + +import com.example.umc10th.domain.review.dto.ReviewReqDTO; +import com.example.umc10th.domain.review.dto.ReviewResDTO; +import com.example.umc10th.domain.review.exception.code.ReviewSuccessCode; +import com.example.umc10th.domain.review.service.ReviewService; +import com.example.umc10th.global.apiPayload.ApiResponse; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Max; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotNull; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +@RestController +@RequiredArgsConstructor +@Validated +@RequestMapping("/reviews") +public class ReviewController { + + private final ReviewService reviewService; + + @GetMapping("/mine") + public ApiResponse> getMyReviews( + @RequestParam @NotNull(message = "회원 ID는 필수입니다.") Long memberId, + @RequestParam(defaultValue = "10") @Min(1) @Max(100) Integer pageSize, + @RequestParam(defaultValue = "-1") String cursor, + @RequestParam @NotNull(message = "정렬(sort)은 필수입니다. id 또는 rating") String sort + ) { + return ApiResponse.onSuccess( + ReviewSuccessCode.MY_REVIEWS_FOUND, + reviewService.getMyReviews(memberId, pageSize, cursor, sort) + ); + } + + @PostMapping + public ApiResponse createReview( + @RequestBody @Valid ReviewReqDTO.CreateReviewDTO request + ) { + + return ApiResponse.onSuccess( + ReviewSuccessCode.REVIEW_CREATED, + reviewService.createReview(request) + ); + } +} diff --git a/src/main/java/com/example/umc10th/domain/review/converter/ReviewConverter.java b/src/main/java/com/example/umc10th/domain/review/converter/ReviewConverter.java new file mode 100644 index 0000000..be9f60b --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/review/converter/ReviewConverter.java @@ -0,0 +1,63 @@ +package com.example.umc10th.domain.review.converter; + +import com.example.umc10th.domain.member.entity.Member; +import com.example.umc10th.domain.review.dto.ReviewReqDTO; +import com.example.umc10th.domain.review.dto.ReviewResDTO; +import com.example.umc10th.domain.review.entity.Review; +import com.example.umc10th.domain.store.entity.Store; + +import java.util.List; + +public class ReviewConverter { + + public static ReviewResDTO.MyReviewDTO toMyReview(Review review) { + return ReviewResDTO.MyReviewDTO.builder() + .reviewId(review.getId()) + .storeId(review.getStore().getId()) + .storeName(review.getStore().getName()) + .content(review.getContent()) + .rating(review.getRating()) + .createdAt(review.getCreatedAt()) + .build(); + } + + public static ReviewResDTO.CursorPagination toCursorPagination( + List data, + Boolean hasNext, + String nextCursor, + Integer pageSize + ) { + return ReviewResDTO.CursorPagination.builder() + .data(data) + .hasNext(hasNext) + .nextCursor(nextCursor) + .pageSize(pageSize) + .build(); + } + + public static Review toReview( + ReviewReqDTO.CreateReviewDTO request, + Member member, + Store store + ) { + + return Review.builder() + .member(member) + .store(store) + .content(request.content()) + .rating(request.rating()) + .build(); + } + + public static ReviewResDTO.CreateReviewResultDTO toCreateReviewResultDTO( + Review review + ) { + + return ReviewResDTO.CreateReviewResultDTO.builder() + .reviewId(review.getId()) + .content(review.getContent()) + .rating(review.getRating()) + .createdAt(review.getCreatedAt()) + .build(); + } +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/domain/review/dto/ReviewReqDTO.java b/src/main/java/com/example/umc10th/domain/review/dto/ReviewReqDTO.java new file mode 100644 index 0000000..0ea0582 --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/review/dto/ReviewReqDTO.java @@ -0,0 +1,23 @@ +package com.example.umc10th.domain.review.dto; + +import jakarta.validation.constraints.Max; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; + +public class ReviewReqDTO { + + public record CreateReviewDTO( + @NotNull(message = "회원 ID는 필수입니다.") + Long memberId, + @NotNull(message = "가게 ID는 필수입니다.") + Long storeId, + @NotBlank(message = "리뷰 내용은 필수입니다.") + String content, + @NotNull(message = "별점은 필수입니다.") + @Min(value = 1, message = "별점은 1 이상이어야 합니다.") + @Max(value = 5, message = "별점은 5 이하여야 합니다.") + Integer rating + ) { + } +} diff --git a/src/main/java/com/example/umc10th/domain/review/dto/ReviewResDTO.java b/src/main/java/com/example/umc10th/domain/review/dto/ReviewResDTO.java new file mode 100644 index 0000000..29b857c --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/review/dto/ReviewResDTO.java @@ -0,0 +1,38 @@ +package com.example.umc10th.domain.review.dto; + +import lombok.Builder; + +import java.time.LocalDateTime; +import java.util.List; + +public class ReviewResDTO { + + @Builder + public record MyReviewDTO( + Long reviewId, + Long storeId, + String storeName, + String content, + Integer rating, + LocalDateTime createdAt + ) { + } + + @Builder + public record CursorPagination( + List data, + Boolean hasNext, + String nextCursor, + Integer pageSize + ) { + } + + @Builder + public record CreateReviewResultDTO( + Long reviewId, + String content, + Integer rating, + LocalDateTime createdAt + ) { + } +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/domain/review/entity/Review.java b/src/main/java/com/example/umc10th/domain/review/entity/Review.java new file mode 100644 index 0000000..3f334ec --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/review/entity/Review.java @@ -0,0 +1,34 @@ +package com.example.umc10th.domain.review.entity; + +import com.example.umc10th.domain.member.entity.Member; +import com.example.umc10th.domain.store.entity.Store; +import com.example.umc10th.global.entity.BaseEntity; +import jakarta.persistence.*; +import lombok.*; + +@Entity +@Getter +@Builder +@AllArgsConstructor +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@Table(name = "review") +public class Review extends BaseEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "review_id") + private Long id; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "member_id") + private Member member; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "store_id") + private Store store; + + @Column(columnDefinition = "TEXT") + private String content; + + private Integer rating; +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/domain/review/exception/ReviewException.java b/src/main/java/com/example/umc10th/domain/review/exception/ReviewException.java new file mode 100644 index 0000000..98fb135 --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/review/exception/ReviewException.java @@ -0,0 +1,11 @@ +package com.example.umc10th.domain.review.exception; + +import com.example.umc10th.global.apiPayload.code.BaseErrorCode; +import com.example.umc10th.global.apiPayload.exception.ProjectException; + +public class ReviewException extends ProjectException { + + public ReviewException(BaseErrorCode errorCode) { + super(errorCode); + } +} diff --git a/src/main/java/com/example/umc10th/domain/review/exception/code/ReviewErrorCode.java b/src/main/java/com/example/umc10th/domain/review/exception/code/ReviewErrorCode.java new file mode 100644 index 0000000..3cfb0dc --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/review/exception/code/ReviewErrorCode.java @@ -0,0 +1,26 @@ +package com.example.umc10th.domain.review.exception.code; + +import com.example.umc10th.global.apiPayload.code.BaseErrorCode; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +@Getter +@RequiredArgsConstructor +public enum ReviewErrorCode implements BaseErrorCode { + + INVALID_SORT( + HttpStatus.BAD_REQUEST, + "REVIEW400_1", + "정렬(sort)은 id 또는 rating 만 허용됩니다." + ), + INVALID_CURSOR( + HttpStatus.BAD_REQUEST, + "REVIEW400_2", + "커서 형식이 올바르지 않습니다." + ); + + private final HttpStatus status; + private final String code; + private final String message; +} diff --git a/src/main/java/com/example/umc10th/domain/review/exception/code/ReviewSuccessCode.java b/src/main/java/com/example/umc10th/domain/review/exception/code/ReviewSuccessCode.java new file mode 100644 index 0000000..cb1ac0f --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/review/exception/code/ReviewSuccessCode.java @@ -0,0 +1,26 @@ +package com.example.umc10th.domain.review.exception.code; + +import com.example.umc10th.global.apiPayload.code.BaseSuccessCode; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +@Getter +@RequiredArgsConstructor +public enum ReviewSuccessCode implements BaseSuccessCode { + + REVIEW_CREATED( + HttpStatus.CREATED, + "REVIEW201_1", + "리뷰가 성공적으로 작성되었습니다." + ), + MY_REVIEWS_FOUND( + HttpStatus.OK, + "REVIEW200_1", + "작성한 리뷰 목록을 성공적으로 조회했습니다." + ); + + private final HttpStatus status; + private final String code; + private final String message; +} diff --git a/src/main/java/com/example/umc10th/domain/review/repository/ReviewRepository.java b/src/main/java/com/example/umc10th/domain/review/repository/ReviewRepository.java new file mode 100644 index 0000000..cb6dbfd --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/review/repository/ReviewRepository.java @@ -0,0 +1,39 @@ +package com.example.umc10th.domain.review.repository; + +import com.example.umc10th.domain.review.entity.Review; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Slice; +import org.springframework.data.jpa.repository.EntityGraph; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +public interface ReviewRepository extends JpaRepository { + + @EntityGraph(attributePaths = { "store" }) + Slice findByMember_IdOrderByIdDesc(Long memberId, Pageable pageable); + + @EntityGraph(attributePaths = { "store" }) + Slice findByMember_IdAndIdLessThanOrderByIdDesc( + Long memberId, + Long id, + Pageable pageable + ); + + @EntityGraph(attributePaths = { "store" }) + Slice findByMember_IdOrderByRatingDescIdDesc(Long memberId, Pageable pageable); + + @EntityGraph(attributePaths = { "store" }) + @Query(""" + select r from Review r + where r.member.id = :memberId + and (r.rating < :lastRating or (r.rating = :lastRating and r.id < :lastId)) + order by r.rating desc, r.id desc + """) + Slice sliceByMember_IdAndRatingCursor( + @Param("memberId") Long memberId, + @Param("lastRating") Integer lastRating, + @Param("lastId") Long lastId, + Pageable pageable + ); +} diff --git a/src/main/java/com/example/umc10th/domain/review/service/ReviewService.java b/src/main/java/com/example/umc10th/domain/review/service/ReviewService.java new file mode 100644 index 0000000..370e741 --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/review/service/ReviewService.java @@ -0,0 +1,121 @@ +package com.example.umc10th.domain.review.service; + +import com.example.umc10th.domain.member.entity.Member; +import com.example.umc10th.domain.member.repository.MemberRepository; +import com.example.umc10th.domain.review.converter.ReviewConverter; +import com.example.umc10th.domain.review.dto.ReviewReqDTO; +import com.example.umc10th.domain.review.dto.ReviewResDTO; +import com.example.umc10th.domain.review.entity.Review; +import com.example.umc10th.domain.review.exception.ReviewException; +import com.example.umc10th.domain.review.exception.code.ReviewErrorCode; +import com.example.umc10th.domain.review.repository.ReviewRepository; +import com.example.umc10th.domain.store.entity.Store; +import com.example.umc10th.domain.store.repository.StoreRepository; +import lombok.RequiredArgsConstructor; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Slice; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +@Service +@RequiredArgsConstructor +@Transactional(readOnly = true) +public class ReviewService { + + private static final String INITIAL_CURSOR = "-1"; + + private final ReviewRepository reviewRepository; + private final MemberRepository memberRepository; + private final StoreRepository storeRepository; + + public ReviewResDTO.CursorPagination getMyReviews( + Long memberId, + Integer pageSize, + String cursor, + String sort + ) { + String normalizedSort = sort.trim().toLowerCase(); + if (!normalizedSort.equals("id") && !normalizedSort.equals("rating")) { + throw new ReviewException(ReviewErrorCode.INVALID_SORT); + } + + PageRequest pageRequest = PageRequest.of(0, pageSize); + Slice slice; + + if (INITIAL_CURSOR.equals(cursor)) { + slice = switch (normalizedSort) { + case "id" -> reviewRepository.findByMember_IdOrderByIdDesc(memberId, pageRequest); + case "rating" -> reviewRepository.findByMember_IdOrderByRatingDescIdDesc( + memberId, + pageRequest + ); + default -> throw new ReviewException(ReviewErrorCode.INVALID_SORT); + }; + } else { + String[] parts = cursor.split(":"); + if (parts.length != 2) { + throw new ReviewException(ReviewErrorCode.INVALID_CURSOR); + } + try { + slice = switch (normalizedSort) { + case "id" -> { + long idBound = Long.parseLong(parts[1]); + yield reviewRepository.findByMember_IdAndIdLessThanOrderByIdDesc( + memberId, + idBound, + pageRequest + ); + } + case "rating" -> { + int lastRating = Integer.parseInt(parts[0]); + long lastId = Long.parseLong(parts[1]); + yield reviewRepository.sliceByMember_IdAndRatingCursor( + memberId, + lastRating, + lastId, + pageRequest + ); + } + default -> throw new ReviewException(ReviewErrorCode.INVALID_SORT); + }; + } catch (NumberFormatException ex) { + throw new ReviewException(ReviewErrorCode.INVALID_CURSOR); + } + } + + List data = + slice.getContent().stream().map(ReviewConverter::toMyReview).toList(); + + String nextCursor = null; + if (slice.hasNext() && !slice.getContent().isEmpty()) { + Review last = slice.getContent().getLast(); + nextCursor = switch (normalizedSort) { + case "id" -> last.getId() + ":" + last.getId(); + case "rating" -> last.getRating() + ":" + last.getId(); + default -> null; + }; + } + + return ReviewConverter.toCursorPagination(data, slice.hasNext(), nextCursor, pageSize); + } + + @Transactional + public ReviewResDTO.CreateReviewResultDTO createReview( + ReviewReqDTO.CreateReviewDTO request + ) { + + Member member = memberRepository.findById(request.memberId()) + .orElseThrow(); + + Store store = storeRepository.findById(request.storeId()) + .orElseThrow(); + + Review review = ReviewConverter.toReview(request, member, store); + + Review savedReview = reviewRepository.save(review); + + return ReviewConverter.toCreateReviewResultDTO(savedReview); + } +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/domain/store/entity/Location.java b/src/main/java/com/example/umc10th/domain/store/entity/Location.java new file mode 100644 index 0000000..59c6998 --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/store/entity/Location.java @@ -0,0 +1,26 @@ +package com.example.umc10th.domain.store.entity; + +import jakarta.persistence.*; +import lombok.*; + +import java.util.ArrayList; +import java.util.List; + +@Entity +@Getter +@Builder +@AllArgsConstructor +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@Table(name = "location") +public class Location { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "location_id") + private Long id; + + private String name; + + @OneToMany(mappedBy = "location") + private List storeList = new ArrayList<>(); +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/domain/store/entity/Store.java b/src/main/java/com/example/umc10th/domain/store/entity/Store.java new file mode 100644 index 0000000..0b0bf0c --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/store/entity/Store.java @@ -0,0 +1,37 @@ +package com.example.umc10th.domain.store.entity; + +import com.example.umc10th.domain.mission.entity.Mission; +import com.example.umc10th.domain.review.entity.Review; +import jakarta.persistence.*; +import lombok.*; + +import java.util.ArrayList; +import java.util.List; + +@Entity +@Getter +@Builder +@AllArgsConstructor +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@Table(name = "store") +public class Store { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "store_id") + private Long id; + + private String name; + + private String address; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "location_id") + private Location location; + + @OneToMany(mappedBy = "store") + private List missionList = new ArrayList<>(); + + @OneToMany(mappedBy = "store") + private List reviewList = new ArrayList<>(); +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/domain/store/repository/LocationRepository.java b/src/main/java/com/example/umc10th/domain/store/repository/LocationRepository.java new file mode 100644 index 0000000..c5f7bb1 --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/store/repository/LocationRepository.java @@ -0,0 +1,7 @@ +package com.example.umc10th.domain.store.repository; + +import com.example.umc10th.domain.store.entity.Location; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface LocationRepository extends JpaRepository { +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/domain/store/repository/StoreRepository.java b/src/main/java/com/example/umc10th/domain/store/repository/StoreRepository.java new file mode 100644 index 0000000..9a66926 --- /dev/null +++ b/src/main/java/com/example/umc10th/domain/store/repository/StoreRepository.java @@ -0,0 +1,7 @@ +package com.example.umc10th.domain.store.repository; + +import com.example.umc10th.domain.store.entity.Store; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface StoreRepository extends JpaRepository { +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/global/apiPayload/ApiResponse.java b/src/main/java/com/example/umc10th/global/apiPayload/ApiResponse.java new file mode 100644 index 0000000..88def63 --- /dev/null +++ b/src/main/java/com/example/umc10th/global/apiPayload/ApiResponse.java @@ -0,0 +1,33 @@ +package com.example.umc10th.global.apiPayload; + +import com.example.umc10th.global.apiPayload.code.BaseErrorCode; +import com.example.umc10th.global.apiPayload.code.BaseSuccessCode; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +@JsonPropertyOrder({"isSuccess", "code", "message", "result"}) +public class ApiResponse { + + @JsonProperty("isSuccess") + private final Boolean isSuccess; + + private final String code; + private final String message; + private T result; + + public static ApiResponse onSuccess(BaseSuccessCode code, T result) { + return new ApiResponse<>(true, code.getCode(), code.getMessage(), result); + } + + public static ApiResponse onSuccess(BaseSuccessCode code) { + return new ApiResponse<>(true, code.getCode(), code.getMessage(), null); + } + + public static ApiResponse onFailure(BaseErrorCode code, T result) { + return new ApiResponse<>(false, code.getCode(), code.getMessage(), result); + } +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/global/apiPayload/code/BaseErrorCode.java b/src/main/java/com/example/umc10th/global/apiPayload/code/BaseErrorCode.java new file mode 100644 index 0000000..ae36d19 --- /dev/null +++ b/src/main/java/com/example/umc10th/global/apiPayload/code/BaseErrorCode.java @@ -0,0 +1,12 @@ +package com.example.umc10th.global.apiPayload.code; + +import org.springframework.http.HttpStatus; + +public interface BaseErrorCode { + + HttpStatus getStatus(); + + String getCode(); + + String getMessage(); +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/global/apiPayload/code/BaseSuccessCode.java b/src/main/java/com/example/umc10th/global/apiPayload/code/BaseSuccessCode.java new file mode 100644 index 0000000..9331465 --- /dev/null +++ b/src/main/java/com/example/umc10th/global/apiPayload/code/BaseSuccessCode.java @@ -0,0 +1,12 @@ +package com.example.umc10th.global.apiPayload.code; + +import org.springframework.http.HttpStatus; + +public interface BaseSuccessCode { + + HttpStatus getStatus(); + + String getCode(); + + String getMessage(); +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/global/apiPayload/code/GeneralErrorCode.java b/src/main/java/com/example/umc10th/global/apiPayload/code/GeneralErrorCode.java new file mode 100644 index 0000000..2e494d3 --- /dev/null +++ b/src/main/java/com/example/umc10th/global/apiPayload/code/GeneralErrorCode.java @@ -0,0 +1,20 @@ +package com.example.umc10th.global.apiPayload.code; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +@Getter +@RequiredArgsConstructor +public enum GeneralErrorCode implements BaseErrorCode { + + BAD_REQUEST(HttpStatus.BAD_REQUEST, "COMMON400_1", "잘못된 요청입니다."), + UNAUTHORIZED(HttpStatus.UNAUTHORIZED, "COMMON401_1", "인증되지 않았습니다."), + FORBIDDEN(HttpStatus.FORBIDDEN, "COMMON403_1", "접근이 금지되었습니다."), + NOT_FOUND(HttpStatus.NOT_FOUND, "COMMON404_1", "해당 리소스를 찾을 수 없습니다."), + INTERNAL_SERVER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "COMMON500_1", "서버 에러가 발생했습니다."); + + private final HttpStatus status; + private final String code; + private final String message; +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/global/apiPayload/exception/GeneralExceptionAdvice.java b/src/main/java/com/example/umc10th/global/apiPayload/exception/GeneralExceptionAdvice.java new file mode 100644 index 0000000..20a4100 --- /dev/null +++ b/src/main/java/com/example/umc10th/global/apiPayload/exception/GeneralExceptionAdvice.java @@ -0,0 +1,56 @@ +package com.example.umc10th.global.apiPayload.exception; + +import com.example.umc10th.global.apiPayload.ApiResponse; +import com.example.umc10th.global.apiPayload.code.BaseErrorCode; +import com.example.umc10th.global.apiPayload.code.GeneralErrorCode; +import jakarta.validation.ConstraintViolation; +import jakarta.validation.ConstraintViolationException; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; + +import java.util.HashMap; +import java.util.Map; +import java.util.stream.Collectors; + +@RestControllerAdvice +public class GeneralExceptionAdvice { + + @ExceptionHandler(MethodArgumentNotValidException.class) + public ResponseEntity>> handleMethodArgumentNotValid( + MethodArgumentNotValidException e + ) { + Map errors = new HashMap<>(); + e.getBindingResult().getFieldErrors().forEach(error -> + errors.put(error.getField(), error.getDefaultMessage()) + ); + + BaseErrorCode code = GeneralErrorCode.BAD_REQUEST; + return ResponseEntity.status(code.getStatus()) + .body(ApiResponse.onFailure(code, errors)); + } + + @ExceptionHandler(ConstraintViolationException.class) + public ResponseEntity>> handleConstraintViolation( + ConstraintViolationException e + ) { + Map errors = e.getConstraintViolations().stream() + .collect(Collectors.toMap( + v -> v.getPropertyPath().toString(), + ConstraintViolation::getMessage, + (a, b) -> a + "; " + b + )); + + BaseErrorCode code = GeneralErrorCode.BAD_REQUEST; + return ResponseEntity.status(code.getStatus()) + .body(ApiResponse.onFailure(code, errors)); + } + + @ExceptionHandler(ProjectException.class) + public ResponseEntity> handleProjectException(ProjectException e) { + BaseErrorCode code = e.getErrorCode(); + return ResponseEntity.status(code.getStatus()) + .body(ApiResponse.onFailure(code, null)); + } +} diff --git a/src/main/java/com/example/umc10th/global/apiPayload/exception/ProjectException.java b/src/main/java/com/example/umc10th/global/apiPayload/exception/ProjectException.java new file mode 100644 index 0000000..dda0c1b --- /dev/null +++ b/src/main/java/com/example/umc10th/global/apiPayload/exception/ProjectException.java @@ -0,0 +1,12 @@ +package com.example.umc10th.global.apiPayload.exception; + +import com.example.umc10th.global.apiPayload.code.BaseErrorCode; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public class ProjectException extends RuntimeException { + + private final BaseErrorCode errorCode; +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/global/config/SwaggerConfig.java b/src/main/java/com/example/umc10th/global/config/SwaggerConfig.java new file mode 100644 index 0000000..7f02eaa --- /dev/null +++ b/src/main/java/com/example/umc10th/global/config/SwaggerConfig.java @@ -0,0 +1,44 @@ +package com.example.umc10th.global.config; + +import io.swagger.v3.oas.models.Components; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Info; +import io.swagger.v3.oas.models.security.SecurityRequirement; +import io.swagger.v3.oas.models.security.SecurityScheme; +import io.swagger.v3.oas.models.servers.Server; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class SwaggerConfig { + + @Bean + public OpenAPI swagger() { + + Info info = new Info() + .title("UMC 10th API") + .description("UMC 10기 Spring Swagger") + .version("1.0.0"); + + String securitySchemeName = "JWT TOKEN"; + + SecurityRequirement securityRequirement = + new SecurityRequirement().addList(securitySchemeName); + + Components components = new Components() + .addSecuritySchemes( + securitySchemeName, + new SecurityScheme() + .name(securitySchemeName) + .type(SecurityScheme.Type.HTTP) + .scheme("bearer") + .bearerFormat("JWT") + ); + + return new OpenAPI() + .info(info) + .addServersItem(new Server().url("/")) + .addSecurityItem(securityRequirement) + .components(components); + } +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/global/entity/BaseEntity.java b/src/main/java/com/example/umc10th/global/entity/BaseEntity.java new file mode 100644 index 0000000..b271bd4 --- /dev/null +++ b/src/main/java/com/example/umc10th/global/entity/BaseEntity.java @@ -0,0 +1,25 @@ +package com.example.umc10th.global.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.EntityListeners; +import jakarta.persistence.MappedSuperclass; +import lombok.Getter; +import org.springframework.data.annotation.CreatedDate; +import org.springframework.data.annotation.LastModifiedDate; +import org.springframework.data.jpa.domain.support.AuditingEntityListener; + +import java.time.LocalDateTime; + +@Getter +@MappedSuperclass +@EntityListeners(AuditingEntityListener.class) +public abstract class BaseEntity { + + @CreatedDate + @Column(name = "created_at", updatable = false) + private LocalDateTime createdAt; + + @LastModifiedDate + @Column(name = "updated_at") + private LocalDateTime updatedAt; +} \ No newline at end of file diff --git a/src/main/java/com/example/umc10th/settings.gradle b/src/main/java/com/example/umc10th/settings.gradle new file mode 100644 index 0000000..67a1b8e --- /dev/null +++ b/src/main/java/com/example/umc10th/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'umc10th' diff --git a/src/main/resources/.gitignore b/src/main/resources/.gitignore new file mode 100644 index 0000000..ae0304e --- /dev/null +++ b/src/main/resources/.gitignore @@ -0,0 +1 @@ +src/main/resources/application.yml \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..5acd671 --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,16 @@ +spring: + datasource: + url: jdbc:mysql://localhost:3306/umc10th + username: root + password: 1s404s0705@@ + driver-class-name: com.mysql.cj.jdbc.Driver + + jpa: + hibernate: + ddl-auto: update + + show-sql: true + + properties: + hibernate: + format_sql: true \ No newline at end of file