From 28d0b4f8d58f56ada987b81aa9fa3255c9dfce46 Mon Sep 17 00:00:00 2001 From: shinyeongwoon Date: Thu, 15 Aug 2024 09:42:20 +0900 Subject: [PATCH 1/2] =?UTF-8?q?SB-251=20(Chore)=20:=20Delivery=20Module=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SB-251 (Chore) : Delivery Module 구현 --- delivery/build.gradle | 56 +++++++++++++++++++ .../java/delivery/domain/TestController.java | 6 ++ settings.gradle | 1 + 3 files changed, 63 insertions(+) create mode 100644 delivery/build.gradle create mode 100644 delivery/src/main/java/delivery/domain/TestController.java diff --git a/delivery/build.gradle b/delivery/build.gradle new file mode 100644 index 00000000..8cb97e13 --- /dev/null +++ b/delivery/build.gradle @@ -0,0 +1,56 @@ +plugins { + id 'java' + id 'org.springframework.boot' + id 'io.spring.dependency-management' +} + +group = 'org.fx' +version = '1.0-SNAPSHOT' + +repositories { + mavenCentral() +} + +dependencies { + testImplementation platform('org.junit:junit-bom:5.10.0') + testImplementation 'org.junit.jupiter:junit-jupiter' + + compileOnly 'org.projectlombok:lombok' + annotationProcessor 'org.projectlombok:lombok' + + implementation 'org.springframework.boot:spring-boot-starter-security' + + implementation 'org.springframework.boot:spring-boot-starter-web' + testImplementation 'org.springframework.boot:spring-boot-starter-test' + + implementation 'org.springframework.boot:spring-boot-starter-data-jpa' + + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2' + + implementation 'io.jsonwebtoken:jjwt-api:0.11.5' + runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5' + runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.5' + + // QueryDsl + implementation 'com.querydsl:querydsl-jpa:5.0.0:jakarta' + annotationProcessor "com.querydsl:querydsl-apt:${dependencyManagement.importedProperties['querydsl.version']}:jakarta" + annotationProcessor "jakarta.annotation:jakarta.annotation-api" + annotationProcessor "jakarta.persistence:jakarta.persistence-api" + + implementation 'org.springframework.boot:spring-boot-starter-validation' + + implementation project(":db") + implementation project(":global") +} + +test { + useJUnitPlatform() +} + +bootJar { + enabled = true +} + +jar { + enabled = false +} \ No newline at end of file diff --git a/delivery/src/main/java/delivery/domain/TestController.java b/delivery/src/main/java/delivery/domain/TestController.java new file mode 100644 index 00000000..7ca38072 --- /dev/null +++ b/delivery/src/main/java/delivery/domain/TestController.java @@ -0,0 +1,6 @@ +package delivery.domain; + +// TODO 삭제 예정 +public class TestController { + +} diff --git a/settings.gradle b/settings.gradle index 6789ff4c..cc3282ab 100644 --- a/settings.gradle +++ b/settings.gradle @@ -2,4 +2,5 @@ rootProject.name = 'baobab' include 'db' include 'global' include 'warehouse' +include 'delivery' From 03369bdd3c09314960fde052cc67295f280c1c07 Mon Sep 17 00:00:00 2001 From: shinyeongwoon Date: Thu, 15 Aug 2024 15:23:50 +0900 Subject: [PATCH 2/2] =?UTF-8?q?SB-252=20(feat)=20:=20=EB=AC=BC=ED=92=88=20?= =?UTF-8?q?id=EB=A5=BC=20=EC=9D=B4=EC=9A=A9=ED=95=98=EC=97=AC=20=EC=9E=85?= =?UTF-8?q?=EA=B3=A0=20=EC=A7=84=ED=96=89=20=EC=A4=91=EC=9D=B8=20=EB=AC=BC?= =?UTF-8?q?=ED=92=88=EC=9D=98=20=EC=83=81=ED=83=9C=EB=A5=BC=20=EC=9E=85?= =?UTF-8?q?=EA=B3=A0=20=EC=99=84=EB=A3=8C=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?=ED=95=98=EB=8A=94=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20api=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SB-252 (feat) : 물품 id를 이용하여 입고 진행 중인 물품의 상태를 입고 완료로 변경하는 테스트 api 추가 --- delivery/build.gradle | 2 +- .../java/delivery/DeliveryApplication.java | 13 +++++++ .../delivery/common/config/JpaConfig.java | 12 +++++++ .../java/delivery/domain/TestController.java | 36 +++++++++++++++++++ delivery/src/main/resources/application.yml | 28 +++++++++++++++ warehouse/src/main/resources/application.yml | 3 ++ 6 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 delivery/src/main/java/delivery/DeliveryApplication.java create mode 100644 delivery/src/main/java/delivery/common/config/JpaConfig.java create mode 100644 delivery/src/main/resources/application.yml diff --git a/delivery/build.gradle b/delivery/build.gradle index 8cb97e13..7fc3cc94 100644 --- a/delivery/build.gradle +++ b/delivery/build.gradle @@ -18,7 +18,7 @@ dependencies { compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' - implementation 'org.springframework.boot:spring-boot-starter-security' + //implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'org.springframework.boot:spring-boot-starter-web' testImplementation 'org.springframework.boot:spring-boot-starter-test' diff --git a/delivery/src/main/java/delivery/DeliveryApplication.java b/delivery/src/main/java/delivery/DeliveryApplication.java new file mode 100644 index 00000000..35ced1a3 --- /dev/null +++ b/delivery/src/main/java/delivery/DeliveryApplication.java @@ -0,0 +1,13 @@ +package delivery; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +//@OpenAPIDefinition(servers = {@Server(url = "https://baobab.run", description = "fx server 연습용 도메인")}) +@SpringBootApplication +public class DeliveryApplication { + + public static void main(String[] args) { + SpringApplication.run(DeliveryApplication.class, args); + } +} \ No newline at end of file diff --git a/delivery/src/main/java/delivery/common/config/JpaConfig.java b/delivery/src/main/java/delivery/common/config/JpaConfig.java new file mode 100644 index 00000000..5522a9ba --- /dev/null +++ b/delivery/src/main/java/delivery/common/config/JpaConfig.java @@ -0,0 +1,12 @@ +package delivery.common.config; + +import org.springframework.boot.autoconfigure.domain.EntityScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; + +@Configuration +@EntityScan(basePackages = {"db"}) +@EnableJpaRepositories(basePackages = {"db"}) +public class JpaConfig { + +} diff --git a/delivery/src/main/java/delivery/domain/TestController.java b/delivery/src/main/java/delivery/domain/TestController.java index 7ca38072..0b118a77 100644 --- a/delivery/src/main/java/delivery/domain/TestController.java +++ b/delivery/src/main/java/delivery/domain/TestController.java @@ -1,6 +1,42 @@ package delivery.domain; +import db.domain.goods.GoodsEntity; +import db.domain.goods.GoodsRepository; +import db.domain.goods.enums.GoodsStatus; +import java.util.Optional; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + // TODO 삭제 예정 +@RestController +@RequiredArgsConstructor +@RequestMapping("/test") public class TestController { + private final GoodsRepository goodsRepository; + + /** + * TODO 삭제 필요 - 임시 + * 물품 id를 이용하여 입고 진행 중인 물품의 상태를 입고 완료로 변경하는 테스트 api 추가 요청합니다. + * (클라이언트에서 입고 완료된 물품을 출고, 중고 등으로 전환 UI 테스트용) + * by. iOS + */ + @PostMapping("/goods/{goodsId}") + public String changGoodsStatus(@PathVariable Long goodsId){ + + Optional goods = goodsRepository.findById(goodsId); + + if(goods.isPresent()){ + GoodsEntity goodsEntity = goods.get(); + goodsEntity.setStatus(GoodsStatus.STORAGE); + goodsRepository.save(goodsEntity); + return "goods status changed !"; + } + + return "goods not found"; + } + } diff --git a/delivery/src/main/resources/application.yml b/delivery/src/main/resources/application.yml new file mode 100644 index 00000000..0c338dcf --- /dev/null +++ b/delivery/src/main/resources/application.yml @@ -0,0 +1,28 @@ +spring: + jpa: + show-sql: true + hibernate: + ddl-auto: validate + properties: + hibernate: + format_sql: true + dialect: org.hibernate.dialect.MySQL8Dialect + datasource: + url: jdbc:mysql://localhost:3306/baobab?useSSL=false&useUnicode=true&allowPublicKeyRetrieval=true + driver-class-name: com.mysql.cj.jdbc.Driver + username: root + password: 1234 +file: + upload-dir: /Users/yeongwoonshin/Desktop/Baobab-SERVER/warehouse/src/main/resources/static/images/ + path : /images/ + +jwt: + secret: + key: shinyangjunglee_baobab_passwordkey + access-token: + plus-hour: 1 + refresh-token: + plus-hour: 12 + +server: + port: 8081 \ No newline at end of file diff --git a/warehouse/src/main/resources/application.yml b/warehouse/src/main/resources/application.yml index 4c8e3625..91a6252d 100644 --- a/warehouse/src/main/resources/application.yml +++ b/warehouse/src/main/resources/application.yml @@ -23,3 +23,6 @@ jwt: plus-hour: 1 refresh-token: plus-hour: 12 + +server: + port: 8080 \ No newline at end of file