From 8f926fd88f25c72044a59e39d4ae2ce06d05b0c2 Mon Sep 17 00:00:00 2001 From: eckrin Date: Thu, 9 Nov 2023 17:19:53 +0900 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20=EA=B0=80=EA=B2=8C=20=EC=8B=A0?= =?UTF-8?q?=EA=B7=9C=EB=93=B1=EB=A1=9D,=20=EA=B0=80=EA=B2=8C=20=EB=A6=AC?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=ED=8E=98=EC=9D=B4=EC=A7=80=EB=84=A4?= =?UTF-8?q?=EC=9D=B4=EC=85=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .DS_Store | Bin 0 -> 8196 bytes .../ISSUE_TEMPLATE/\342\234\205-feature.md" | 20 +++ build.gradle | 29 ++++ src/.DS_Store | Bin 0 -> 6148 bytes src/main/.DS_Store | Bin 0 -> 6148 bytes .../jipbap/chat/domain/entity/QMessage.java | 67 +++++++++ .../jipbap/chat/domain/entity/QRoom.java | 64 +++++++++ .../jipbap/common/entity/QDateEntity.java | 39 ++++++ .../com/kusitms/jipbap/food/QCategory.java | 49 +++++++ .../com/kusitms/jipbap/food/QFood.java | 70 ++++++++++ .../jipbap/notifiication/QNotification.java | 65 +++++++++ .../com/kusitms/jipbap/order/QCart.java | 62 +++++++++ .../com/kusitms/jipbap/order/QOrder.java | 64 +++++++++ .../com/kusitms/jipbap/order/QReview.java | 63 +++++++++ .../com/kusitms/jipbap/post/QPost.java | 57 ++++++++ .../com/kusitms/jipbap/store/QStore.java | 77 +++++++++++ .../kusitms/jipbap/store/QStoreBookmark.java | 62 +++++++++ .../com/kusitms/jipbap/user/QUser.java | 65 +++++++++ src/main/java/.DS_Store | Bin 0 -> 6148 bytes src/main/java/com/.DS_Store | Bin 0 -> 6148 bytes src/main/java/com/kusitms/.DS_Store | Bin 0 -> 6148 bytes src/main/java/com/kusitms/jipbap/.DS_Store | Bin 0 -> 8196 bytes .../java/com/kusitms/jipbap/auth/.DS_Store | Bin 0 -> 6148 bytes .../java/com/kusitms/jipbap/chat/.DS_Store | Bin 0 -> 6148 bytes .../com/kusitms/jipbap/chat/domain/.DS_Store | Bin 0 -> 6148 bytes .../java/com/kusitms/jipbap/common/.DS_Store | Bin 0 -> 6148 bytes .../kusitms/jipbap/common/QueryDslUtil.java | 14 ++ .../kusitms/jipbap/config/QueryDslConfig.java | 18 +++ .../java/com/kusitms/jipbap/order/Review.java | 1 - .../java/com/kusitms/jipbap/store/Store.java | 20 ++- .../kusitms/jipbap/store/StoreBookmark.java | 2 +- .../jipbap/store/StoreBookmarkRepository.java | 8 ++ .../kusitms/jipbap/store/StoreController.java | 45 +++++- .../kusitms/jipbap/store/StoreRepository.java | 2 +- .../store/StoreRepositoryExtension.java | 12 ++ .../store/StoreRepositoryExtensionImpl.java | 129 ++++++++++++++++++ .../kusitms/jipbap/store/StoreService.java | 17 ++- .../store/dto/RegisterStoreRequestDto.java | 3 +- .../store/dto/SearchStoreResponseDto.java | 22 +++ .../kusitms/jipbap/store/dto/StoreDto.java | 18 +++ 40 files changed, 1150 insertions(+), 14 deletions(-) create mode 100644 .DS_Store create mode 100644 ".github/ISSUE_TEMPLATE/\342\234\205-feature.md" create mode 100644 src/.DS_Store create mode 100644 src/main/.DS_Store create mode 100644 src/main/generated/com/kusitms/jipbap/chat/domain/entity/QMessage.java create mode 100644 src/main/generated/com/kusitms/jipbap/chat/domain/entity/QRoom.java create mode 100644 src/main/generated/com/kusitms/jipbap/common/entity/QDateEntity.java create mode 100644 src/main/generated/com/kusitms/jipbap/food/QCategory.java create mode 100644 src/main/generated/com/kusitms/jipbap/food/QFood.java create mode 100644 src/main/generated/com/kusitms/jipbap/notifiication/QNotification.java create mode 100644 src/main/generated/com/kusitms/jipbap/order/QCart.java create mode 100644 src/main/generated/com/kusitms/jipbap/order/QOrder.java create mode 100644 src/main/generated/com/kusitms/jipbap/order/QReview.java create mode 100644 src/main/generated/com/kusitms/jipbap/post/QPost.java create mode 100644 src/main/generated/com/kusitms/jipbap/store/QStore.java create mode 100644 src/main/generated/com/kusitms/jipbap/store/QStoreBookmark.java create mode 100644 src/main/generated/com/kusitms/jipbap/user/QUser.java create mode 100644 src/main/java/.DS_Store create mode 100644 src/main/java/com/.DS_Store create mode 100644 src/main/java/com/kusitms/.DS_Store create mode 100644 src/main/java/com/kusitms/jipbap/.DS_Store create mode 100644 src/main/java/com/kusitms/jipbap/auth/.DS_Store create mode 100644 src/main/java/com/kusitms/jipbap/chat/.DS_Store create mode 100644 src/main/java/com/kusitms/jipbap/chat/domain/.DS_Store create mode 100644 src/main/java/com/kusitms/jipbap/common/.DS_Store create mode 100644 src/main/java/com/kusitms/jipbap/common/QueryDslUtil.java create mode 100644 src/main/java/com/kusitms/jipbap/config/QueryDslConfig.java create mode 100644 src/main/java/com/kusitms/jipbap/store/StoreBookmarkRepository.java create mode 100644 src/main/java/com/kusitms/jipbap/store/StoreRepositoryExtension.java create mode 100644 src/main/java/com/kusitms/jipbap/store/StoreRepositoryExtensionImpl.java create mode 100644 src/main/java/com/kusitms/jipbap/store/dto/SearchStoreResponseDto.java create mode 100644 src/main/java/com/kusitms/jipbap/store/dto/StoreDto.java diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..2a90b35ce33bad6fa5ba15fb0fececcb3010db03 GIT binary patch literal 8196 zcmeHMziSjh6n=BNno|p7K#X8uA=V*DFRbBGD;(*QyA79EA&9tTK#>%d+6np> z2v*vp2wK<(mR44FffXV1-=F-}KiXh-1GDCeU}B6*8?-|m51lR_VfIo4=WylD;{Mky!=VyY zFsYC7_|Q#&IkZh$ql5;u?(sQ4)viWxK98R5J@okG^9<91Pkoff=R&0UoPs`ma9O7{ zkBgc+<9j&|wfuDIz1_lA*=Rx)~2`GgQ zrC-OV7hvE#9DDateCw^%Klc`>Rj-HFoX4bC*A{iL@;;49s1)v&{T%ztjVF8V9rWhl z>et11JnZ2cfX60vJ>?rO6SHpP;n>etW_tO$owrzb)$8F+V887FF6X~~1Eh!oC$B(Y zA*OZyzg&O+fAT~GK@<=L{+a?RY_(fUfOoldg^13zBh*z?U36S#tr>#Gq~owA9f!^T cFvN3&P(3DgHnSEzC~^^CWROM__@fH^0z7UWdH?_b literal 0 HcmV?d00001 diff --git "a/.github/ISSUE_TEMPLATE/\342\234\205-feature.md" "b/.github/ISSUE_TEMPLATE/\342\234\205-feature.md" new file mode 100644 index 0000000..f990c02 --- /dev/null +++ "b/.github/ISSUE_TEMPLATE/\342\234\205-feature.md" @@ -0,0 +1,20 @@ +--- +name: "✅ FEATURE" +about: 기능구현 시 작성해주세요 +title: "[FEAT]" +labels: enhancement +assignees: '' + +--- + +## ✏️ Description +설명을 작성하세요. + +## 📝 ToDo +- [ ] todo +- [ ] todo + +## ETC + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/build.gradle b/build.gradle index 463d8d7..5f35045 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,14 @@ +//buildscript { +// ext { +// queryDslVersion = "5.0.0" +// } +//} + plugins { id 'java' id 'org.springframework.boot' version '3.1.3' id 'io.spring.dependency-management' version '1.1.3' +// id "com.ewerk.gradle.plugins.querydsl" version "1.0.10" //QueryDsl } group = 'com.kusitms' @@ -19,6 +26,7 @@ configurations { compileOnly { extendsFrom annotationProcessor } +// querydsl.extendsFrom compileClasspath } repositories { @@ -53,9 +61,30 @@ dependencies { //lombok compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' + //queryDsl + implementation 'com.querydsl:querydsl-jpa:5.0.0:jakarta' + annotationProcessor 'com.querydsl:querydsl-apt:5.0.0:jakarta' + annotationProcessor "jakarta.annotation:jakarta.annotation-api" + annotationProcessor "jakarta.persistence:jakarta.persistence-api" + testImplementation 'org.springframework.boot:spring-boot-starter-test' } tasks.named('test') { useJUnitPlatform() } + +//def querydslDir = "$buildDir/generated/querydsl" +// +//querydsl { +// jpa = true +// querydslSourcesDir = querydslDir +//} +// +//sourceSets { +// main.java.srcDir querydslDir +//} +// +//compileQuerydsl{ +// options.annotationProcessorPath = configurations.querydsl +//} diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..259adc89f884eaa6c317f52584c302e7f7e04e5c GIT binary patch literal 6148 zcmeHKK~BRk5Zo;hio~TyE=ay{E-wgGctJlM>-NTrk`l3&6j_yZ?C!4o)e;>4_X zfmlQw5h}ZqJ@$^*n~W4YOGG@qT~3I`L{y>)vJ3`H+=JA}77NL;$9grHU9`<+V3WV< zl4mcdp>w*Xo9y{V_wzp2v~|5$w+r~n=aZw=)7|4~&M$xDH&;Dv_FoW+yj!}Yj<#7| zVR~FY@5Aw1_u5%ri*4GkyhD7JSNHbb6>tSy0axIED}Xy&tUOTk-W6~KT!Bvoe3!^$u!f`PGy0yUJa#9$4FKiIm;Fe+*|u@xU|nLmmb zPT8@4NXv;UMekh!S0GnlPp4zK|IhHr3>Nu$h|gRBS765!;G&+@Q@oVjt>0cx?%IGh tM-!8EQ3f!Kv!4J=T!CLu;2mz%M$7;J literal 0 HcmV?d00001 diff --git a/src/main/.DS_Store b/src/main/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..70fd7126534c90f97f5c9c136287611eafb78ddf GIT binary patch literal 6148 zcmeHKJ5Iwu5S?`#$q`LT3W~i#Y6?tb!~t>v@V{f&=ho zXB51$lMfw4^CL&@_5}$;ormS5`$aTU9gIveV16<;TFfgv0LfGNyDFz2%b=Xk|ju@-~};v^L)sZNg=PSRob z8kZ~9f|5=y?2L7EXQw9=7j}o;hj4PappC|WF%UD*lglCZ|BKz{|2WC6i~(cdpcrsz zF)7BlCGD-Po8w;Vp;u5Aj;jT?DVT&-j96~P$Iu|Kd!7Ju#aa*+i2Voz8f-8I{*-|q D4e(C` literal 0 HcmV?d00001 diff --git a/src/main/generated/com/kusitms/jipbap/chat/domain/entity/QMessage.java b/src/main/generated/com/kusitms/jipbap/chat/domain/entity/QMessage.java new file mode 100644 index 0000000..0a2b3a0 --- /dev/null +++ b/src/main/generated/com/kusitms/jipbap/chat/domain/entity/QMessage.java @@ -0,0 +1,67 @@ +package com.kusitms.jipbap.chat.domain.entity; + +import static com.querydsl.core.types.PathMetadataFactory.*; + +import com.querydsl.core.types.dsl.*; + +import com.querydsl.core.types.PathMetadata; +import javax.annotation.processing.Generated; +import com.querydsl.core.types.Path; +import com.querydsl.core.types.dsl.PathInits; + + +/** + * QMessage is a Querydsl query type for Message + */ +@Generated("com.querydsl.codegen.DefaultEntitySerializer") +public class QMessage extends EntityPathBase { + + private static final long serialVersionUID = -928480451L; + + private static final PathInits INITS = PathInits.DIRECT2; + + public static final QMessage message1 = new QMessage("message1"); + + public final com.kusitms.jipbap.common.entity.QDateEntity _super = new com.kusitms.jipbap.common.entity.QDateEntity(this); + + //inherited + public final DateTimePath createdAt = _super.createdAt; + + public final NumberPath id = createNumber("id", Long.class); + + public final StringPath message = createString("message"); + + public final StringPath receiverName = createString("receiverName"); + + public final QRoom room; + + public final StringPath senderName = createString("senderName"); + + public final StringPath sentTime = createString("sentTime"); + + //inherited + public final DateTimePath updatedAt = _super.updatedAt; + + public QMessage(String variable) { + this(Message.class, forVariable(variable), INITS); + } + + public QMessage(Path path) { + this(path.getType(), path.getMetadata(), PathInits.getFor(path.getMetadata(), INITS)); + } + + public QMessage(PathMetadata metadata) { + this(metadata, PathInits.getFor(metadata, INITS)); + } + + public QMessage(PathMetadata metadata, PathInits inits) { + this(Message.class, metadata, inits); + } + + public QMessage(Class type, PathMetadata metadata, PathInits inits) { + super(type, metadata, inits); + this.room = inits.isInitialized("room") ? new QRoom(forProperty("room"), inits.get("room")) : null; + } + +} + diff --git a/src/main/generated/com/kusitms/jipbap/chat/domain/entity/QRoom.java b/src/main/generated/com/kusitms/jipbap/chat/domain/entity/QRoom.java new file mode 100644 index 0000000..6db28c7 --- /dev/null +++ b/src/main/generated/com/kusitms/jipbap/chat/domain/entity/QRoom.java @@ -0,0 +1,64 @@ +package com.kusitms.jipbap.chat.domain.entity; + +import static com.querydsl.core.types.PathMetadataFactory.*; + +import com.querydsl.core.types.dsl.*; + +import com.querydsl.core.types.PathMetadata; +import javax.annotation.processing.Generated; +import com.querydsl.core.types.Path; +import com.querydsl.core.types.dsl.PathInits; + + +/** + * QRoom is a Querydsl query type for Room + */ +@Generated("com.querydsl.codegen.DefaultEntitySerializer") +public class QRoom extends EntityPathBase { + + private static final long serialVersionUID = 1449900389L; + + private static final PathInits INITS = PathInits.DIRECT2; + + public static final QRoom room = new QRoom("room"); + + public final NumberPath id = createNumber("id", Long.class); + + public final ListPath messageList = this.createList("messageList", Message.class, QMessage.class, PathInits.DIRECT2); + + public final StringPath receiverName = createString("receiverName"); + + public final StringPath roomId = createString("roomId"); + + public final StringPath roomName = createString("roomName"); + + public final StringPath senderName = createString("senderName"); + + public final com.kusitms.jipbap.store.QStore store; + + public final com.kusitms.jipbap.user.QUser user; + + public QRoom(String variable) { + this(Room.class, forVariable(variable), INITS); + } + + public QRoom(Path path) { + this(path.getType(), path.getMetadata(), PathInits.getFor(path.getMetadata(), INITS)); + } + + public QRoom(PathMetadata metadata) { + this(metadata, PathInits.getFor(metadata, INITS)); + } + + public QRoom(PathMetadata metadata, PathInits inits) { + this(Room.class, metadata, inits); + } + + public QRoom(Class type, PathMetadata metadata, PathInits inits) { + super(type, metadata, inits); + this.store = inits.isInitialized("store") ? new com.kusitms.jipbap.store.QStore(forProperty("store"), inits.get("store")) : null; + this.user = inits.isInitialized("user") ? new com.kusitms.jipbap.user.QUser(forProperty("user")) : null; + } + +} + diff --git a/src/main/generated/com/kusitms/jipbap/common/entity/QDateEntity.java b/src/main/generated/com/kusitms/jipbap/common/entity/QDateEntity.java new file mode 100644 index 0000000..228441c --- /dev/null +++ b/src/main/generated/com/kusitms/jipbap/common/entity/QDateEntity.java @@ -0,0 +1,39 @@ +package com.kusitms.jipbap.common.entity; + +import static com.querydsl.core.types.PathMetadataFactory.*; + +import com.querydsl.core.types.dsl.*; + +import com.querydsl.core.types.PathMetadata; +import javax.annotation.processing.Generated; +import com.querydsl.core.types.Path; + + +/** + * QDateEntity is a Querydsl query type for DateEntity + */ +@Generated("com.querydsl.codegen.DefaultSupertypeSerializer") +public class QDateEntity extends EntityPathBase { + + private static final long serialVersionUID = -170761146L; + + public static final QDateEntity dateEntity = new QDateEntity("dateEntity"); + + public final DateTimePath createdAt = createDateTime("createdAt", java.time.LocalDateTime.class); + + public final DateTimePath updatedAt = createDateTime("updatedAt", java.time.LocalDateTime.class); + + public QDateEntity(String variable) { + super(DateEntity.class, forVariable(variable)); + } + + public QDateEntity(Path path) { + super(path.getType(), path.getMetadata()); + } + + public QDateEntity(PathMetadata metadata) { + super(DateEntity.class, metadata); + } + +} + diff --git a/src/main/generated/com/kusitms/jipbap/food/QCategory.java b/src/main/generated/com/kusitms/jipbap/food/QCategory.java new file mode 100644 index 0000000..bb4ab7a --- /dev/null +++ b/src/main/generated/com/kusitms/jipbap/food/QCategory.java @@ -0,0 +1,49 @@ +package com.kusitms.jipbap.food; + +import static com.querydsl.core.types.PathMetadataFactory.*; + +import com.querydsl.core.types.dsl.*; + +import com.querydsl.core.types.PathMetadata; +import javax.annotation.processing.Generated; +import com.querydsl.core.types.Path; + + +/** + * QCategory is a Querydsl query type for Category + */ +@Generated("com.querydsl.codegen.DefaultEntitySerializer") +public class QCategory extends EntityPathBase { + + private static final long serialVersionUID = 1489953153L; + + public static final QCategory category = new QCategory("category"); + + public final com.kusitms.jipbap.common.entity.QDateEntity _super = new com.kusitms.jipbap.common.entity.QDateEntity(this); + + //inherited + public final DateTimePath createdAt = _super.createdAt; + + public final NumberPath id = createNumber("id", Long.class); + + public final StringPath image = createString("image"); + + public final StringPath name = createString("name"); + + //inherited + public final DateTimePath updatedAt = _super.updatedAt; + + public QCategory(String variable) { + super(Category.class, forVariable(variable)); + } + + public QCategory(Path path) { + super(path.getType(), path.getMetadata()); + } + + public QCategory(PathMetadata metadata) { + super(Category.class, metadata); + } + +} + diff --git a/src/main/generated/com/kusitms/jipbap/food/QFood.java b/src/main/generated/com/kusitms/jipbap/food/QFood.java new file mode 100644 index 0000000..2f47c48 --- /dev/null +++ b/src/main/generated/com/kusitms/jipbap/food/QFood.java @@ -0,0 +1,70 @@ +package com.kusitms.jipbap.food; + +import static com.querydsl.core.types.PathMetadataFactory.*; + +import com.querydsl.core.types.dsl.*; + +import com.querydsl.core.types.PathMetadata; +import javax.annotation.processing.Generated; +import com.querydsl.core.types.Path; +import com.querydsl.core.types.dsl.PathInits; + + +/** + * QFood is a Querydsl query type for Food + */ +@Generated("com.querydsl.codegen.DefaultEntitySerializer") +public class QFood extends EntityPathBase { + + private static final long serialVersionUID = -1116673439L; + + private static final PathInits INITS = PathInits.DIRECT2; + + public static final QFood food = new QFood("food"); + + public final com.kusitms.jipbap.common.entity.QDateEntity _super = new com.kusitms.jipbap.common.entity.QDateEntity(this); + + public final QCategory category; + + //inherited + public final DateTimePath createdAt = _super.createdAt; + + public final StringPath description = createString("description"); + + public final NumberPath id = createNumber("id", Long.class); + + public final StringPath name = createString("name"); + + public final NumberPath price = createNumber("price", Long.class); + + public final NumberPath recommendCount = createNumber("recommendCount", Long.class); + + public final com.kusitms.jipbap.store.QStore store; + + //inherited + public final DateTimePath updatedAt = _super.updatedAt; + + public QFood(String variable) { + this(Food.class, forVariable(variable), INITS); + } + + public QFood(Path path) { + this(path.getType(), path.getMetadata(), PathInits.getFor(path.getMetadata(), INITS)); + } + + public QFood(PathMetadata metadata) { + this(metadata, PathInits.getFor(metadata, INITS)); + } + + public QFood(PathMetadata metadata, PathInits inits) { + this(Food.class, metadata, inits); + } + + public QFood(Class type, PathMetadata metadata, PathInits inits) { + super(type, metadata, inits); + this.category = inits.isInitialized("category") ? new QCategory(forProperty("category")) : null; + this.store = inits.isInitialized("store") ? new com.kusitms.jipbap.store.QStore(forProperty("store"), inits.get("store")) : null; + } + +} + diff --git a/src/main/generated/com/kusitms/jipbap/notifiication/QNotification.java b/src/main/generated/com/kusitms/jipbap/notifiication/QNotification.java new file mode 100644 index 0000000..9d082e4 --- /dev/null +++ b/src/main/generated/com/kusitms/jipbap/notifiication/QNotification.java @@ -0,0 +1,65 @@ +package com.kusitms.jipbap.notifiication; + +import static com.querydsl.core.types.PathMetadataFactory.*; + +import com.querydsl.core.types.dsl.*; + +import com.querydsl.core.types.PathMetadata; +import javax.annotation.processing.Generated; +import com.querydsl.core.types.Path; +import com.querydsl.core.types.dsl.PathInits; + + +/** + * QNotification is a Querydsl query type for Notification + */ +@Generated("com.querydsl.codegen.DefaultEntitySerializer") +public class QNotification extends EntityPathBase { + + private static final long serialVersionUID = -150217532L; + + private static final PathInits INITS = PathInits.DIRECT2; + + public static final QNotification notification = new QNotification("notification"); + + public final com.kusitms.jipbap.common.entity.QDateEntity _super = new com.kusitms.jipbap.common.entity.QDateEntity(this); + + //inherited + public final DateTimePath createdAt = _super.createdAt; + + public final NumberPath id = createNumber("id", Long.class); + + public final StringPath message = createString("message"); + + public final EnumPath notificationType = createEnum("notificationType", Notification.NotificationType.class); + + public final BooleanPath readYn = createBoolean("readYn"); + + //inherited + public final DateTimePath updatedAt = _super.updatedAt; + + public final com.kusitms.jipbap.user.QUser user; + + public QNotification(String variable) { + this(Notification.class, forVariable(variable), INITS); + } + + public QNotification(Path path) { + this(path.getType(), path.getMetadata(), PathInits.getFor(path.getMetadata(), INITS)); + } + + public QNotification(PathMetadata metadata) { + this(metadata, PathInits.getFor(metadata, INITS)); + } + + public QNotification(PathMetadata metadata, PathInits inits) { + this(Notification.class, metadata, inits); + } + + public QNotification(Class type, PathMetadata metadata, PathInits inits) { + super(type, metadata, inits); + this.user = inits.isInitialized("user") ? new com.kusitms.jipbap.user.QUser(forProperty("user")) : null; + } + +} + diff --git a/src/main/generated/com/kusitms/jipbap/order/QCart.java b/src/main/generated/com/kusitms/jipbap/order/QCart.java new file mode 100644 index 0000000..5b76ec0 --- /dev/null +++ b/src/main/generated/com/kusitms/jipbap/order/QCart.java @@ -0,0 +1,62 @@ +package com.kusitms.jipbap.order; + +import static com.querydsl.core.types.PathMetadataFactory.*; + +import com.querydsl.core.types.dsl.*; + +import com.querydsl.core.types.PathMetadata; +import javax.annotation.processing.Generated; +import com.querydsl.core.types.Path; +import com.querydsl.core.types.dsl.PathInits; + + +/** + * QCart is a Querydsl query type for Cart + */ +@Generated("com.querydsl.codegen.DefaultEntitySerializer") +public class QCart extends EntityPathBase { + + private static final long serialVersionUID = 1961564653L; + + private static final PathInits INITS = PathInits.DIRECT2; + + public static final QCart cart = new QCart("cart"); + + public final com.kusitms.jipbap.common.entity.QDateEntity _super = new com.kusitms.jipbap.common.entity.QDateEntity(this); + + //inherited + public final DateTimePath createdAt = _super.createdAt; + + public final com.kusitms.jipbap.food.QFood food; + + public final NumberPath id = createNumber("id", Long.class); + + //inherited + public final DateTimePath updatedAt = _super.updatedAt; + + public final com.kusitms.jipbap.user.QUser user; + + public QCart(String variable) { + this(Cart.class, forVariable(variable), INITS); + } + + public QCart(Path path) { + this(path.getType(), path.getMetadata(), PathInits.getFor(path.getMetadata(), INITS)); + } + + public QCart(PathMetadata metadata) { + this(metadata, PathInits.getFor(metadata, INITS)); + } + + public QCart(PathMetadata metadata, PathInits inits) { + this(Cart.class, metadata, inits); + } + + public QCart(Class type, PathMetadata metadata, PathInits inits) { + super(type, metadata, inits); + this.food = inits.isInitialized("food") ? new com.kusitms.jipbap.food.QFood(forProperty("food"), inits.get("food")) : null; + this.user = inits.isInitialized("user") ? new com.kusitms.jipbap.user.QUser(forProperty("user")) : null; + } + +} + diff --git a/src/main/generated/com/kusitms/jipbap/order/QOrder.java b/src/main/generated/com/kusitms/jipbap/order/QOrder.java new file mode 100644 index 0000000..9b6a21f --- /dev/null +++ b/src/main/generated/com/kusitms/jipbap/order/QOrder.java @@ -0,0 +1,64 @@ +package com.kusitms.jipbap.order; + +import static com.querydsl.core.types.PathMetadataFactory.*; + +import com.querydsl.core.types.dsl.*; + +import com.querydsl.core.types.PathMetadata; +import javax.annotation.processing.Generated; +import com.querydsl.core.types.Path; +import com.querydsl.core.types.dsl.PathInits; + + +/** + * QOrder is a Querydsl query type for Order + */ +@Generated("com.querydsl.codegen.DefaultEntitySerializer") +public class QOrder extends EntityPathBase { + + private static final long serialVersionUID = 690536993L; + + private static final PathInits INITS = PathInits.DIRECT2; + + public static final QOrder order = new QOrder("order1"); + + public final com.kusitms.jipbap.common.entity.QDateEntity _super = new com.kusitms.jipbap.common.entity.QDateEntity(this); + + //inherited + public final DateTimePath createdAt = _super.createdAt; + + public final com.kusitms.jipbap.food.QFood food; + + public final NumberPath id = createNumber("id", Long.class); + + public final NumberPath orderCount = createNumber("orderCount", Long.class); + + //inherited + public final DateTimePath updatedAt = _super.updatedAt; + + public final com.kusitms.jipbap.user.QUser user; + + public QOrder(String variable) { + this(Order.class, forVariable(variable), INITS); + } + + public QOrder(Path path) { + this(path.getType(), path.getMetadata(), PathInits.getFor(path.getMetadata(), INITS)); + } + + public QOrder(PathMetadata metadata) { + this(metadata, PathInits.getFor(metadata, INITS)); + } + + public QOrder(PathMetadata metadata, PathInits inits) { + this(Order.class, metadata, inits); + } + + public QOrder(Class type, PathMetadata metadata, PathInits inits) { + super(type, metadata, inits); + this.food = inits.isInitialized("food") ? new com.kusitms.jipbap.food.QFood(forProperty("food"), inits.get("food")) : null; + this.user = inits.isInitialized("user") ? new com.kusitms.jipbap.user.QUser(forProperty("user")) : null; + } + +} + diff --git a/src/main/generated/com/kusitms/jipbap/order/QReview.java b/src/main/generated/com/kusitms/jipbap/order/QReview.java new file mode 100644 index 0000000..f3f45f7 --- /dev/null +++ b/src/main/generated/com/kusitms/jipbap/order/QReview.java @@ -0,0 +1,63 @@ +package com.kusitms.jipbap.order; + +import static com.querydsl.core.types.PathMetadataFactory.*; + +import com.querydsl.core.types.dsl.*; + +import com.querydsl.core.types.PathMetadata; +import javax.annotation.processing.Generated; +import com.querydsl.core.types.Path; +import com.querydsl.core.types.dsl.PathInits; + + +/** + * QReview is a Querydsl query type for Review + */ +@Generated("com.querydsl.codegen.DefaultEntitySerializer") +public class QReview extends EntityPathBase { + + private static final long serialVersionUID = 6231781L; + + private static final PathInits INITS = PathInits.DIRECT2; + + public static final QReview review = new QReview("review"); + + public final com.kusitms.jipbap.common.entity.QDateEntity _super = new com.kusitms.jipbap.common.entity.QDateEntity(this); + + //inherited + public final DateTimePath createdAt = _super.createdAt; + + public final NumberPath id = createNumber("id", Long.class); + + public final StringPath message = createString("message"); + + public final QOrder order; + + public final NumberPath rating = createNumber("rating", Long.class); + + //inherited + public final DateTimePath updatedAt = _super.updatedAt; + + public QReview(String variable) { + this(Review.class, forVariable(variable), INITS); + } + + public QReview(Path path) { + this(path.getType(), path.getMetadata(), PathInits.getFor(path.getMetadata(), INITS)); + } + + public QReview(PathMetadata metadata) { + this(metadata, PathInits.getFor(metadata, INITS)); + } + + public QReview(PathMetadata metadata, PathInits inits) { + this(Review.class, metadata, inits); + } + + public QReview(Class type, PathMetadata metadata, PathInits inits) { + super(type, metadata, inits); + this.order = inits.isInitialized("order") ? new QOrder(forProperty("order"), inits.get("order")) : null; + } + +} + diff --git a/src/main/generated/com/kusitms/jipbap/post/QPost.java b/src/main/generated/com/kusitms/jipbap/post/QPost.java new file mode 100644 index 0000000..8847b4c --- /dev/null +++ b/src/main/generated/com/kusitms/jipbap/post/QPost.java @@ -0,0 +1,57 @@ +package com.kusitms.jipbap.post; + +import static com.querydsl.core.types.PathMetadataFactory.*; + +import com.querydsl.core.types.dsl.*; + +import com.querydsl.core.types.PathMetadata; +import javax.annotation.processing.Generated; +import com.querydsl.core.types.Path; + + +/** + * QPost is a Querydsl query type for Post + */ +@Generated("com.querydsl.codegen.DefaultEntitySerializer") +public class QPost extends EntityPathBase { + + private static final long serialVersionUID = 1997030305L; + + public static final QPost post = new QPost("post"); + + public final com.kusitms.jipbap.common.entity.QDateEntity _super = new com.kusitms.jipbap.common.entity.QDateEntity(this); + + public final StringPath content = createString("content"); + + //inherited + public final DateTimePath createdAt = _super.createdAt; + + public final DateTimePath createdBy = createDateTime("createdBy", java.time.LocalDateTime.class); + + public final NumberPath hit = createNumber("hit", Long.class); + + public final NumberPath id = createNumber("id", Long.class); + + public final EnumPath postType = createEnum("postType", Post.PostType.class); + + public final StringPath title = createString("title"); + + //inherited + public final DateTimePath updatedAt = _super.updatedAt; + + public final DateTimePath updatedBy = createDateTime("updatedBy", java.time.LocalDateTime.class); + + public QPost(String variable) { + super(Post.class, forVariable(variable)); + } + + public QPost(Path path) { + super(path.getType(), path.getMetadata()); + } + + public QPost(PathMetadata metadata) { + super(Post.class, metadata); + } + +} + diff --git a/src/main/generated/com/kusitms/jipbap/store/QStore.java b/src/main/generated/com/kusitms/jipbap/store/QStore.java new file mode 100644 index 0000000..a36f2a0 --- /dev/null +++ b/src/main/generated/com/kusitms/jipbap/store/QStore.java @@ -0,0 +1,77 @@ +package com.kusitms.jipbap.store; + +import static com.querydsl.core.types.PathMetadataFactory.*; + +import com.querydsl.core.types.dsl.*; + +import com.querydsl.core.types.PathMetadata; +import javax.annotation.processing.Generated; +import com.querydsl.core.types.Path; +import com.querydsl.core.types.dsl.PathInits; + + +/** + * QStore is a Querydsl query type for Store + */ +@Generated("com.querydsl.codegen.DefaultEntitySerializer") +public class QStore extends EntityPathBase { + + private static final long serialVersionUID = 1530325767L; + + private static final PathInits INITS = PathInits.DIRECT2; + + public static final QStore store = new QStore("store"); + + public final com.kusitms.jipbap.common.entity.QDateEntity _super = new com.kusitms.jipbap.common.entity.QDateEntity(this); + + public final NumberPath avgRate = createNumber("avgRate", Double.class); + + public final NumberPath bookmarkCount = createNumber("bookmarkCount", Long.class); + + //inherited + public final DateTimePath createdAt = _super.createdAt; + + public final StringPath description = createString("description"); + + public final NumberPath id = createNumber("id", Long.class); + + public final StringPath image = createString("image"); + + public final BooleanPath koreanYn = createBoolean("koreanYn"); + + public final NumberPath minOrderAmount = createNumber("minOrderAmount", Long.class); + + public final StringPath name = createString("name"); + + public final com.kusitms.jipbap.user.QUser owner; + + public final NumberPath rateCount = createNumber("rateCount", Long.class); + + public final NumberPath reviewCount = createNumber("reviewCount", Long.class); + + //inherited + public final DateTimePath updatedAt = _super.updatedAt; + + public QStore(String variable) { + this(Store.class, forVariable(variable), INITS); + } + + public QStore(Path path) { + this(path.getType(), path.getMetadata(), PathInits.getFor(path.getMetadata(), INITS)); + } + + public QStore(PathMetadata metadata) { + this(metadata, PathInits.getFor(metadata, INITS)); + } + + public QStore(PathMetadata metadata, PathInits inits) { + this(Store.class, metadata, inits); + } + + public QStore(Class type, PathMetadata metadata, PathInits inits) { + super(type, metadata, inits); + this.owner = inits.isInitialized("owner") ? new com.kusitms.jipbap.user.QUser(forProperty("owner")) : null; + } + +} + diff --git a/src/main/generated/com/kusitms/jipbap/store/QStoreBookmark.java b/src/main/generated/com/kusitms/jipbap/store/QStoreBookmark.java new file mode 100644 index 0000000..aef2d53 --- /dev/null +++ b/src/main/generated/com/kusitms/jipbap/store/QStoreBookmark.java @@ -0,0 +1,62 @@ +package com.kusitms.jipbap.store; + +import static com.querydsl.core.types.PathMetadataFactory.*; + +import com.querydsl.core.types.dsl.*; + +import com.querydsl.core.types.PathMetadata; +import javax.annotation.processing.Generated; +import com.querydsl.core.types.Path; +import com.querydsl.core.types.dsl.PathInits; + + +/** + * QStoreBookmark is a Querydsl query type for StoreBookmark + */ +@Generated("com.querydsl.codegen.DefaultEntitySerializer") +public class QStoreBookmark extends EntityPathBase { + + private static final long serialVersionUID = 542965085L; + + private static final PathInits INITS = PathInits.DIRECT2; + + public static final QStoreBookmark storeBookmark = new QStoreBookmark("storeBookmark"); + + public final com.kusitms.jipbap.common.entity.QDateEntity _super = new com.kusitms.jipbap.common.entity.QDateEntity(this); + + //inherited + public final DateTimePath createdAt = _super.createdAt; + + public final NumberPath id = createNumber("id", Long.class); + + public final QStore store; + + //inherited + public final DateTimePath updatedAt = _super.updatedAt; + + public final com.kusitms.jipbap.user.QUser user; + + public QStoreBookmark(String variable) { + this(StoreBookmark.class, forVariable(variable), INITS); + } + + public QStoreBookmark(Path path) { + this(path.getType(), path.getMetadata(), PathInits.getFor(path.getMetadata(), INITS)); + } + + public QStoreBookmark(PathMetadata metadata) { + this(metadata, PathInits.getFor(metadata, INITS)); + } + + public QStoreBookmark(PathMetadata metadata, PathInits inits) { + this(StoreBookmark.class, metadata, inits); + } + + public QStoreBookmark(Class type, PathMetadata metadata, PathInits inits) { + super(type, metadata, inits); + this.store = inits.isInitialized("store") ? new QStore(forProperty("store"), inits.get("store")) : null; + this.user = inits.isInitialized("user") ? new com.kusitms.jipbap.user.QUser(forProperty("user")) : null; + } + +} + diff --git a/src/main/generated/com/kusitms/jipbap/user/QUser.java b/src/main/generated/com/kusitms/jipbap/user/QUser.java new file mode 100644 index 0000000..32b4a65 --- /dev/null +++ b/src/main/generated/com/kusitms/jipbap/user/QUser.java @@ -0,0 +1,65 @@ +package com.kusitms.jipbap.user; + +import static com.querydsl.core.types.PathMetadataFactory.*; + +import com.querydsl.core.types.dsl.*; + +import com.querydsl.core.types.PathMetadata; +import javax.annotation.processing.Generated; +import com.querydsl.core.types.Path; + + +/** + * QUser is a Querydsl query type for User + */ +@Generated("com.querydsl.codegen.DefaultEntitySerializer") +public class QUser extends EntityPathBase { + + private static final long serialVersionUID = 333743745L; + + public static final QUser user = new QUser("user"); + + public final com.kusitms.jipbap.common.entity.QDateEntity _super = new com.kusitms.jipbap.common.entity.QDateEntity(this); + + public final StringPath address = createString("address"); + + //inherited + public final DateTimePath createdAt = _super.createdAt; + + public final StringPath email = createString("email"); + + public final StringPath fcmToken = createString("fcmToken"); + + public final NumberPath id = createNumber("id", Long.class); + + public final StringPath image = createString("image"); + + public final StringPath oauth = createString("oauth"); + + public final StringPath password = createString("password"); + + public final StringPath phoneNum = createString("phoneNum"); + + public final StringPath refreshToken = createString("refreshToken"); + + public final EnumPath role = createEnum("role", Role.class); + + //inherited + public final DateTimePath updatedAt = _super.updatedAt; + + public final StringPath username = createString("username"); + + public QUser(String variable) { + super(User.class, forVariable(variable)); + } + + public QUser(Path path) { + super(path.getType(), path.getMetadata()); + } + + public QUser(PathMetadata metadata) { + super(User.class, metadata); + } + +} + diff --git a/src/main/java/.DS_Store b/src/main/java/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5238c5294753546f9567661284ef58056a0fbc9a GIT binary patch literal 6148 zcmeHKJ5B>J5FL|6T8SnlrLT}1IMH%~TmU7JKq#wCLy5FqS`NWM(xjr~LcI9|Hmsne zfH%_k*)#KO?JIU{5lM^3%}it}A~jr5_BxDB^XenJh)4xYy2os}?%JJ2Pq`84OF+33 zSxYDF_HM|pof^YXDdRdq+fI$*Dl6rg&l` zrz4)Dt_1duPM2gSW1l!V#S10b>4;}5msA`%QUNM(uE4~XQ|-b|t~`n0A$;{w9MTIn zibxf7zv`|}_dJ;HE+XRDZZ##E5K)6B$f8t4rmLm{cOC&*bKFr!+x6vianV;2{lzKS z`!U_pj<$47U-sW^bi4fau`8R^WyfMD TS!7eu05^h`cd$ literal 0 HcmV?d00001 diff --git a/src/main/java/com/kusitms/.DS_Store b/src/main/java/com/kusitms/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..03d9596dc2803adb3abe5a6a8529eaf88a52fc89 GIT binary patch literal 6148 zcmeHKJ5Iwu5S@X5ETu_FL9tiJ4NPQCkPCo`6hMjWh7xH@E|w}S*WeDkw=*D|SfYy% znvr(j?EGv$$-6ruqKlW+Tx2F96$VkMj0nx6t}_pw0JYS(mwvOJFCV&XKT_x~n)vRQ z@+?o%ODl)(ukUY%{%zMZ?WSvCucjZ@>;3EQ<~U~cYfS(6gQts(5+T7rFc1s`1Hr&a z7{HlLsiuZ82Lr)CF!0R)_lJZ*tR1sq**Y+l768a=bP?$6C76>OYsYK|4@4~$XsPNg zhFUu8$>VCrY-s7C-h8M(`Kx)+@^sWsC0w*Nj5!zx28Ilr+j7S9{}#W@Xp=uoiB&KV z4E!?&bkZ!F1wP8p)}znkS(`BKFer@6R3Oj?mjEodk6aa}`4e@-)sESaRcJ5iz_ z>JJbLI}1?+SwRb9Z6hdxm4#>{i|2hfb8lu6ti;v#!n`}oy?4%e=g!N^n-Gz=IBF~q zRfwpBL)r2!bU97=)sbmC?3Eg{B_(Bb5T#=71q;1tLzp!V)QouLs8sV(>K zr><~cH>%fH*P~TjD_x(vckSuL7e}POG1K2~vv&h#min|tZD0>2?t|C*zShTaA1%$d zUR}1hi9f~7^Gn{tD5F4rK>FL48fyPJAI9b)uKfexyIX8|@-mBPE((VW}(YT>KpHsk)B?eAqs{(6-u zg6V)7)TDt_uCxWd%**-h`J8AcBGSs`M@W1%ZBe&A7;H?=pTZ69l|B(M8`gyPUb*Q6;KRX$2D z=W=J|{a|e763geR>_7Urdiau_^(;c--%|KK(3{zM6z92*W8bb+(|KfbIdYy~;_7<% zsD!G>#8X)Qq;ai}<38NSa1(#3d!Aq7_SJY@+ujNk4E>7Q|1V8{|G&Kl>DW63oB}fy z@cjC6eGwscZ=DHNd+h+n3J%p&Tx_gPL8rIluzEWVoBUyj^8leLC$u&;7FW>z_=|u6 XHThcT)_?Qcf&cDs>%V?9|LN{0y!zQ4 literal 0 HcmV?d00001 diff --git a/src/main/java/com/kusitms/jipbap/auth/.DS_Store b/src/main/java/com/kusitms/jipbap/auth/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..ff4c1a1fb0f5803686312abebcb3a6f64a94bc32 GIT binary patch literal 6148 zcmeHKJ5Iwu5S@)vIMAe|+$*G^Hj(L(a)Br@f=F@J5=2VrJ8%(>K*Jq40wtnI&6}N3 zV#_8aLeY#g^X&QTuAe23hlt#CTTF`}_RgF0wmgz!*3y2HY^8z5|3OGKi1-D?oliKvRg>eWyc1ov~v#fEO#g9KFXOs9U& zwE2AItKm8_TTEA=n?ffv%Mi}X@=V6Bmz1$^PLpy~ZUN^O`0!1m8&JYcoACGvgqaMJ z?O>6z<+7GnwLHt_Y2##T3#{23)g7g-b`CfPoCB!?{Cx0HSOcwzQu*jWCAR=j56v=g z%zFtQ<7*AHCQ8wR5Naq?4HbHeA=GfR`#LYsnkZGnN$Aao&}SBUha%+JF~2X3s@w>Wg|8Ea+@0DDnX?#Ka!ltZsa*}E_`NFG`-mF4 zrnEfk?|=7cV`)=eFP3QmO?7#{|N40Me9*Tx-&j}Y{j3pTv`wdUg^Cv#w`JAp<)gh{ z`{-d^yU5X|%?`fuDfba%A1=;-GvEw31OJl&+}R@4j-t=bfHU9>tQnB=Az%nb!%i_D z9hh{*s{e9}d|9 znKV>Wg?t*Cwa-%jWSh@=KIbpTpHB~xPiL;O`p)Smzjj`p^D;38i~(a{-xxs6X36@B z)*1uGfHAOQfWHqO%9uwCit_0|BUb=m3bP3M@-GMUYyjpFgCZ;tr=dU%b@7VfG#qvx z{ql%GQNzi}%9tmv?BWf@$?C9saVM86T5Aj#18oKl^l`xT|7`dDza3;x#(*)fR}8qc z7#AbFQmn0=m*ZONp%+jV_6v%u5Okyz!Kjw7 literal 0 HcmV?d00001 diff --git a/src/main/java/com/kusitms/jipbap/common/QueryDslUtil.java b/src/main/java/com/kusitms/jipbap/common/QueryDslUtil.java new file mode 100644 index 0000000..b72da60 --- /dev/null +++ b/src/main/java/com/kusitms/jipbap/common/QueryDslUtil.java @@ -0,0 +1,14 @@ +package com.kusitms.jipbap.common; + +import com.querydsl.core.types.Order; +import com.querydsl.core.types.OrderSpecifier; +import com.querydsl.core.types.Path; +import com.querydsl.core.types.dsl.Expressions; + +public class QueryDslUtil { + + public static OrderSpecifier getSortedColumn(Order order, Path parent, String fieldName) { + Path fieldPath = Expressions.path(Object.class, parent, fieldName); + return new OrderSpecifier(order, fieldPath); + } +} \ No newline at end of file diff --git a/src/main/java/com/kusitms/jipbap/config/QueryDslConfig.java b/src/main/java/com/kusitms/jipbap/config/QueryDslConfig.java new file mode 100644 index 0000000..1cd6ede --- /dev/null +++ b/src/main/java/com/kusitms/jipbap/config/QueryDslConfig.java @@ -0,0 +1,18 @@ +package com.kusitms.jipbap.config; + +import com.querydsl.jpa.impl.JPAQueryFactory; +import jakarta.persistence.EntityManager; +import lombok.RequiredArgsConstructor; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +@RequiredArgsConstructor +public class QueryDslConfig { + private final EntityManager entityManager; + + @Bean + public JPAQueryFactory jpaQueryFactory() { + return new JPAQueryFactory(entityManager); + } +} \ No newline at end of file diff --git a/src/main/java/com/kusitms/jipbap/order/Review.java b/src/main/java/com/kusitms/jipbap/order/Review.java index 6b5a685..2922e57 100644 --- a/src/main/java/com/kusitms/jipbap/order/Review.java +++ b/src/main/java/com/kusitms/jipbap/order/Review.java @@ -27,7 +27,6 @@ public class Review extends DateEntity { private Order order; private Long rating; - private Long like; private String message; } \ No newline at end of file diff --git a/src/main/java/com/kusitms/jipbap/store/Store.java b/src/main/java/com/kusitms/jipbap/store/Store.java index 486f5ea..b325ef5 100644 --- a/src/main/java/com/kusitms/jipbap/store/Store.java +++ b/src/main/java/com/kusitms/jipbap/store/Store.java @@ -26,7 +26,6 @@ public class Store extends DateEntity { @JoinColumn private User owner; - //TODO("읍면동 지역 id?") private String name; @@ -36,7 +35,24 @@ public class Store extends DateEntity { @Column(columnDefinition = "TINYINT(1)") private Boolean koreanYn; //한국인 인증 여부 - private Double avgRate; + private Double avgRate; // 가게 평점 + private Long rateCount; // 평점 개수 + private Long bookmarkCount; // 가게 즐겨찾기 횟수 (추천순) + private Long reviewCount; // 가게 후기 개수 + + private Long minOrderAmount; //최소 주문 금액 private String image; + + public void increaseBookmarkCount() { + this.bookmarkCount++; + } + + public void increaseReviewCount() { + this.reviewCount++; + } + + public void updateAvgRate(Double newRate) { + this.avgRate = (avgRate*rateCount+newRate)/(rateCount+1); + } } \ No newline at end of file diff --git a/src/main/java/com/kusitms/jipbap/store/StoreBookmark.java b/src/main/java/com/kusitms/jipbap/store/StoreBookmark.java index b924e0b..34efbf1 100644 --- a/src/main/java/com/kusitms/jipbap/store/StoreBookmark.java +++ b/src/main/java/com/kusitms/jipbap/store/StoreBookmark.java @@ -24,7 +24,7 @@ public class StoreBookmark extends DateEntity { @ManyToOne(fetch = FetchType.LAZY) @JoinColumn - private User owner; + private User user; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn diff --git a/src/main/java/com/kusitms/jipbap/store/StoreBookmarkRepository.java b/src/main/java/com/kusitms/jipbap/store/StoreBookmarkRepository.java new file mode 100644 index 0000000..a4eb7ab --- /dev/null +++ b/src/main/java/com/kusitms/jipbap/store/StoreBookmarkRepository.java @@ -0,0 +1,8 @@ +package com.kusitms.jipbap.store; + +import com.kusitms.jipbap.user.User; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface StoreBookmarkRepository extends JpaRepository { + Boolean existsByUserAndStore(User user, Store store); +} diff --git a/src/main/java/com/kusitms/jipbap/store/StoreController.java b/src/main/java/com/kusitms/jipbap/store/StoreController.java index c6793db..120c990 100644 --- a/src/main/java/com/kusitms/jipbap/store/StoreController.java +++ b/src/main/java/com/kusitms/jipbap/store/StoreController.java @@ -4,14 +4,15 @@ import com.kusitms.jipbap.security.Auth; import com.kusitms.jipbap.security.AuthInfo; import com.kusitms.jipbap.store.dto.RegisterStoreRequestDto; -import com.kusitms.jipbap.user.User; -import com.kusitms.jipbap.user.UserRepository; -import com.kusitms.jipbap.user.exception.UserNotFoundException; +import com.kusitms.jipbap.store.dto.SearchStoreResponseDto; +import com.kusitms.jipbap.store.dto.StoreDto; +import io.swagger.v3.oas.annotations.Operation; import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Slice; +import org.springframework.data.domain.Sort; +import org.springframework.web.bind.annotation.*; import javax.validation.Valid; @@ -20,11 +21,41 @@ @RequiredArgsConstructor public class StoreController { + private final int PAGESIZE = 10; private final StoreService storeService; + @Operation(summary = "가게 등록하기") @PostMapping public CommonResponse registerStore(@Auth AuthInfo authInfo, @Valid @RequestBody RegisterStoreRequestDto dto) { storeService.registerStore(authInfo.getEmail(), dto); return new CommonResponse<>("가게 등록 완료"); } + + /** + * 가게 검색 api - 페이지네이션 적용 + * @param keyword: 검색 키워드 (키워드가 포함한 가게를 검색한다) + * @param sortField: 검색 기준 (추천-bookmark, 후기-review, 평점-rate, 가격-price, 최신-id) + * (추천순: 가게 즐겨찾기 개수 순서, 후기: 가게에 속한 주문에 달린 리뷰 수) + * @param sortDirection: 정렬 기준 (ASC, DESC) + * @param lastId: 결과 리스트에서 포함되어도 되는 id의 최대값 + * @return Slice: 슬라이스 단위 + */ + @Operation(summary = "가게 검색") + @GetMapping + public CommonResponse> searchStore( + @Auth AuthInfo authInfo, + @RequestParam(required = false) String keyword, + @RequestParam String sortField, + @RequestParam String sortDirection, + @RequestParam(required = false) Long lastId + ) { + Sort sort; + if ("asc".equals(sortDirection) || "ASC".equals(sortDirection)) { + sort = Sort.by(Sort.Direction.ASC, sortField); + } else { + sort = Sort.by(Sort.Direction.DESC, sortField); + } + Pageable pageable = PageRequest.of(0, PAGESIZE, sort); + return new CommonResponse<>(storeService.searchStoreList(authInfo.getEmail(), pageable, keyword, sortField, sortDirection, lastId)); + } } diff --git a/src/main/java/com/kusitms/jipbap/store/StoreRepository.java b/src/main/java/com/kusitms/jipbap/store/StoreRepository.java index 27a10f8..0633d54 100644 --- a/src/main/java/com/kusitms/jipbap/store/StoreRepository.java +++ b/src/main/java/com/kusitms/jipbap/store/StoreRepository.java @@ -2,5 +2,5 @@ import org.springframework.data.jpa.repository.JpaRepository; -public interface StoreRepository extends JpaRepository { +public interface StoreRepository extends JpaRepository, StoreRepositoryExtension { } diff --git a/src/main/java/com/kusitms/jipbap/store/StoreRepositoryExtension.java b/src/main/java/com/kusitms/jipbap/store/StoreRepositoryExtension.java new file mode 100644 index 0000000..fc2b6d4 --- /dev/null +++ b/src/main/java/com/kusitms/jipbap/store/StoreRepositoryExtension.java @@ -0,0 +1,12 @@ +package com.kusitms.jipbap.store; + +import com.kusitms.jipbap.store.dto.SearchStoreResponseDto; +import com.kusitms.jipbap.store.dto.StoreDto; +import com.kusitms.jipbap.user.User; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Slice; + +public interface StoreRepositoryExtension { + + Slice searchByKeywordOrderBySort(User user, Pageable pageable, String keyword, String standard, String order, Long lastId); +} diff --git a/src/main/java/com/kusitms/jipbap/store/StoreRepositoryExtensionImpl.java b/src/main/java/com/kusitms/jipbap/store/StoreRepositoryExtensionImpl.java new file mode 100644 index 0000000..f602792 --- /dev/null +++ b/src/main/java/com/kusitms/jipbap/store/StoreRepositoryExtensionImpl.java @@ -0,0 +1,129 @@ +package com.kusitms.jipbap.store; + +import com.kusitms.jipbap.common.QueryDslUtil; +import com.kusitms.jipbap.store.dto.SearchStoreResponseDto; +import com.kusitms.jipbap.user.User; +import com.querydsl.core.types.Order; +import com.querydsl.core.types.OrderSpecifier; +import com.querydsl.core.types.dsl.BooleanExpression; +import com.querydsl.jpa.impl.JPAQueryFactory; +import lombok.RequiredArgsConstructor; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Slice; +import org.springframework.data.domain.SliceImpl; +import org.springframework.data.domain.Sort; + +import java.util.ArrayList; +import java.util.List; + +import static com.kusitms.jipbap.store.QStore.store; +import static org.springframework.util.ObjectUtils.isEmpty; + +@RequiredArgsConstructor +public class StoreRepositoryExtensionImpl implements StoreRepositoryExtension{ + + private final JPAQueryFactory queryFactory; + private final StoreBookmarkRepository storeBookmarkRepository; + + @Override + public Slice searchByKeywordOrderBySort(User user, Pageable pageable, String keyword, String standard, String order, Long lastId) { + + List orderSpecifiers = getAllOrderSpecifiers(pageable); + + List storeList = queryFactory.selectFrom(store) + .where( + ltId(lastId), + containsKeyword(keyword) + ) + .limit(pageable.getPageSize()+1) + .orderBy(orderSpecifiers.toArray(OrderSpecifier[]::new)) + .fetch(); + + List dtoList = new ArrayList<>(); + + for(Store s: storeList) { + dtoList.add(new SearchStoreResponseDto( + s.getId(), + s.getName(), + s.getDescription(), + s.getKoreanYn(), + s.getAvgRate(), + s.getMinOrderAmount(), + s.getImage(), + isUserBookmarkedStore(user, s), + getLastId(lastId) + )); + } + + // 무한스크롤을 위한 길이 확인 + boolean hasNext = false; + if(storeList.size() > pageable.getPageSize()) { + dtoList.remove(pageable.getPageSize()); + hasNext = true; + } + + return new SliceImpl<>(dtoList, pageable, hasNext); + } + + // lastId가 null이라면 현재 가장 마지막에 추가된 store id 반환 + private Long getLastId(Long lastId) { + if(lastId == null) { + return queryFactory.select(store.id) + .from(store) + .limit(1) + .orderBy(store.id.desc()) + .fetchFirst(); + } + return lastId; + } + + // user가 즐겨찾기한 store인지 검사 + private Boolean isUserBookmarkedStore(User user, Store store) { + return storeBookmarkRepository.existsByUserAndStore(user, store); + } + + // no-offset 방식 처리하는 메서드 + private BooleanExpression ltId(Long id) { + if(id == null) { + return null; + } + return store.id.lt(id); + } + + private BooleanExpression containsKeyword(String keyword) { + if(keyword == null) { + return null; + } + return store.name.contains(keyword); + } + + private List getAllOrderSpecifiers(Pageable pageable) { + + List orderSpecifierList = new ArrayList<>(); + + if (!isEmpty(pageable.getSort())) { + for (Sort.Order order : pageable.getSort()) { + Order direction = order.getDirection().isAscending() ? Order.ASC : Order.DESC; + switch (order.getProperty()) { + // 기본 정렬조건: 추천순 + case "bookmark": // 추천순 + orderSpecifierList.add(QueryDslUtil.getSortedColumn(direction, store, "bookmarkCount")); + break; + case "review": // 후기순 + orderSpecifierList.add(QueryDslUtil.getSortedColumn(direction, store, "reviewCount")); + break; + case "rate": // 평점순 + orderSpecifierList.add(QueryDslUtil.getSortedColumn(direction, store, "avgRate")); + break; + case "id": // 최신순 + orderSpecifierList.add(QueryDslUtil.getSortedColumn(direction, store, "id")); + break; + default: + break; + } + } + } + + return orderSpecifierList; + } +} diff --git a/src/main/java/com/kusitms/jipbap/store/StoreService.java b/src/main/java/com/kusitms/jipbap/store/StoreService.java index bb6582c..9e6dfa3 100644 --- a/src/main/java/com/kusitms/jipbap/store/StoreService.java +++ b/src/main/java/com/kusitms/jipbap/store/StoreService.java @@ -1,12 +1,17 @@ package com.kusitms.jipbap.store; import com.kusitms.jipbap.store.dto.RegisterStoreRequestDto; +import com.kusitms.jipbap.store.dto.SearchStoreResponseDto; +import com.kusitms.jipbap.store.dto.StoreDto; import com.kusitms.jipbap.user.User; import com.kusitms.jipbap.user.UserRepository; import com.kusitms.jipbap.user.exception.UserNotFoundException; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Slice; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; @Slf4j @Service @@ -16,11 +21,21 @@ public class StoreService { private final StoreRepository storeRepository; private final UserRepository userRepository; + @Transactional public void registerStore(String email, RegisterStoreRequestDto dto) { User user = userRepository.findByEmail(email).orElseThrow(()-> new UserNotFoundException("유저 정보가 존재하지 않습니다.")); storeRepository.save( - new Store(null, user, dto.getName(), dto.getDescription(), dto.getKoreanYn(), dto.getAvgRate(), null) + new Store(null, user, dto.getName(), dto.getDescription(), dto.getKoreanYn(), 0D, 0L, 0L, 0L, dto.getMinOrderAmount(), null) ); } + + @Transactional + public Slice searchStoreList(String email, Pageable pageable, String keyword, String standard, String order, Long lastId) { + User user = userRepository.findByEmail(email).orElseThrow(()-> new UserNotFoundException("유저 정보가 존재하지 않습니다.")); + + return storeRepository.searchByKeywordOrderBySort(user, pageable, keyword, standard, order, lastId); + } + + } diff --git a/src/main/java/com/kusitms/jipbap/store/dto/RegisterStoreRequestDto.java b/src/main/java/com/kusitms/jipbap/store/dto/RegisterStoreRequestDto.java index 688a652..73cbb56 100644 --- a/src/main/java/com/kusitms/jipbap/store/dto/RegisterStoreRequestDto.java +++ b/src/main/java/com/kusitms/jipbap/store/dto/RegisterStoreRequestDto.java @@ -11,5 +11,6 @@ public class RegisterStoreRequestDto { private String name; private String description; private Boolean koreanYn; - private Double avgRate; + + private Long minOrderAmount; } diff --git a/src/main/java/com/kusitms/jipbap/store/dto/SearchStoreResponseDto.java b/src/main/java/com/kusitms/jipbap/store/dto/SearchStoreResponseDto.java new file mode 100644 index 0000000..d54a3b3 --- /dev/null +++ b/src/main/java/com/kusitms/jipbap/store/dto/SearchStoreResponseDto.java @@ -0,0 +1,22 @@ +package com.kusitms.jipbap.store.dto; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +public class SearchStoreResponseDto { + + private Long id; + private String name; + private String description; + private Boolean koreanYn; + private Double avgRate; + private Long minOrderAmount; + private String image; + + private Boolean isBookmarked; + private Long lastId; +} diff --git a/src/main/java/com/kusitms/jipbap/store/dto/StoreDto.java b/src/main/java/com/kusitms/jipbap/store/dto/StoreDto.java new file mode 100644 index 0000000..7e30af3 --- /dev/null +++ b/src/main/java/com/kusitms/jipbap/store/dto/StoreDto.java @@ -0,0 +1,18 @@ +package com.kusitms.jipbap.store.dto; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class StoreDto { + + private Long id; + private String name; + private String description; + private Boolean koreanYn; + private Double avgRate; + private Long bookmarkCount; + private String image; +} From d74e5c8af25d3ccc5b8438b6e7301cb8791d7451 Mon Sep 17 00:00:00 2001 From: eckrin Date: Thu, 9 Nov 2023 19:10:34 +0900 Subject: [PATCH 2/4] =?UTF-8?q?fix:=20=EC=97=94=ED=8B=B0=ED=8B=B0=20?= =?UTF-8?q?=EC=BB=AC=EB=9F=BC=EB=AA=85=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/kusitms/jipbap/food/Category.java | 1 + src/main/java/com/kusitms/jipbap/food/Food.java | 5 +++-- src/main/java/com/kusitms/jipbap/order/Cart.java | 4 ++-- src/main/java/com/kusitms/jipbap/order/Order.java | 4 ++-- src/main/java/com/kusitms/jipbap/order/Review.java | 2 +- src/main/java/com/kusitms/jipbap/store/Store.java | 5 +++-- src/main/java/com/kusitms/jipbap/store/StoreBookmark.java | 4 ++-- 7 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/kusitms/jipbap/food/Category.java b/src/main/java/com/kusitms/jipbap/food/Category.java index 6558bd7..0eea689 100644 --- a/src/main/java/com/kusitms/jipbap/food/Category.java +++ b/src/main/java/com/kusitms/jipbap/food/Category.java @@ -20,6 +20,7 @@ public class Category extends DateEntity { @Column(name ="category_id") private Long id; //고유 pk + @Column(name = "category_name") private String name; private String image; diff --git a/src/main/java/com/kusitms/jipbap/food/Food.java b/src/main/java/com/kusitms/jipbap/food/Food.java index 0a5163b..7db8417 100644 --- a/src/main/java/com/kusitms/jipbap/food/Food.java +++ b/src/main/java/com/kusitms/jipbap/food/Food.java @@ -23,13 +23,14 @@ public class Food extends DateEntity { private Long id; //고유 pk @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn + @JoinColumn(name = "store_id") private Store store; @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn + @JoinColumn(name = "category_id") private Category category; + @Column(name = "food_name") private String name; private Long price; private String description; diff --git a/src/main/java/com/kusitms/jipbap/order/Cart.java b/src/main/java/com/kusitms/jipbap/order/Cart.java index 5fb36af..ea3b8ae 100644 --- a/src/main/java/com/kusitms/jipbap/order/Cart.java +++ b/src/main/java/com/kusitms/jipbap/order/Cart.java @@ -24,11 +24,11 @@ public class Cart extends DateEntity { private Long id; //고유 pk @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn + @JoinColumn(name = "user_id") private User user; @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn + @JoinColumn(name = "food_id") private Food food; } \ No newline at end of file diff --git a/src/main/java/com/kusitms/jipbap/order/Order.java b/src/main/java/com/kusitms/jipbap/order/Order.java index 8c87859..b88046d 100644 --- a/src/main/java/com/kusitms/jipbap/order/Order.java +++ b/src/main/java/com/kusitms/jipbap/order/Order.java @@ -25,11 +25,11 @@ public class Order extends DateEntity { private Long id; //고유 pk @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn + @JoinColumn(name = "user_id") private User user; @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn + @JoinColumn(name = "food_id") private Food food; private Long orderCount; diff --git a/src/main/java/com/kusitms/jipbap/order/Review.java b/src/main/java/com/kusitms/jipbap/order/Review.java index 2922e57..a70ce19 100644 --- a/src/main/java/com/kusitms/jipbap/order/Review.java +++ b/src/main/java/com/kusitms/jipbap/order/Review.java @@ -23,7 +23,7 @@ public class Review extends DateEntity { private Long id; //고유 pk @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn + @JoinColumn(name = "order_id") private Order order; private Long rating; diff --git a/src/main/java/com/kusitms/jipbap/store/Store.java b/src/main/java/com/kusitms/jipbap/store/Store.java index b325ef5..6660a89 100644 --- a/src/main/java/com/kusitms/jipbap/store/Store.java +++ b/src/main/java/com/kusitms/jipbap/store/Store.java @@ -23,11 +23,12 @@ public class Store extends DateEntity { private Long id; //고유 pk @OneToOne(fetch = FetchType.LAZY) - @JoinColumn + @JoinColumn(name = "owner_id") private User owner; //TODO("읍면동 지역 id?") - + + @Column(name = "store_name") private String name; private String description; diff --git a/src/main/java/com/kusitms/jipbap/store/StoreBookmark.java b/src/main/java/com/kusitms/jipbap/store/StoreBookmark.java index 34efbf1..54ea80c 100644 --- a/src/main/java/com/kusitms/jipbap/store/StoreBookmark.java +++ b/src/main/java/com/kusitms/jipbap/store/StoreBookmark.java @@ -23,11 +23,11 @@ public class StoreBookmark extends DateEntity { private Long id; //고유 pk @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn + @JoinColumn(name = "user_id") private User user; @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn + @JoinColumn(name = "store_id") private Store store; From 042767f57499054701c6ff64336c4f80a5b67bc0 Mon Sep 17 00:00:00 2001 From: eckrin Date: Thu, 9 Nov 2023 21:19:49 +0900 Subject: [PATCH 3/4] =?UTF-8?q?fix:=20=EC=97=94=ED=8B=B0=ED=8B=B0=20pk?= =?UTF-8?q?=EC=BB=AC=EB=9F=BC=EB=AA=85=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/kusitms/jipbap/food/Category.java | 2 +- .../java/com/kusitms/jipbap/food/Food.java | 2 +- .../jipbap/notifiication/Notification.java | 2 +- .../java/com/kusitms/jipbap/order/Cart.java | 2 +- .../java/com/kusitms/jipbap/order/Order.java | 2 +- .../java/com/kusitms/jipbap/order/Review.java | 2 +- .../java/com/kusitms/jipbap/post/Post.java | 2 +- .../java/com/kusitms/jipbap/store/Store.java | 2 +- .../kusitms/jipbap/store/StoreBookmark.java | 2 +- .../kusitms/jipbap/store/StoreController.java | 19 +++++++++---------- .../java/com/kusitms/jipbap/user/User.java | 2 +- 11 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/kusitms/jipbap/food/Category.java b/src/main/java/com/kusitms/jipbap/food/Category.java index 0eea689..54311c4 100644 --- a/src/main/java/com/kusitms/jipbap/food/Category.java +++ b/src/main/java/com/kusitms/jipbap/food/Category.java @@ -17,7 +17,7 @@ public class Category extends DateEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name ="category_id") + @Column(name ="id") private Long id; //고유 pk @Column(name = "category_name") diff --git a/src/main/java/com/kusitms/jipbap/food/Food.java b/src/main/java/com/kusitms/jipbap/food/Food.java index 7db8417..25f877b 100644 --- a/src/main/java/com/kusitms/jipbap/food/Food.java +++ b/src/main/java/com/kusitms/jipbap/food/Food.java @@ -19,7 +19,7 @@ public class Food extends DateEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name ="food_id") + @Column(name ="id") private Long id; //고유 pk @ManyToOne(fetch = FetchType.LAZY) diff --git a/src/main/java/com/kusitms/jipbap/notifiication/Notification.java b/src/main/java/com/kusitms/jipbap/notifiication/Notification.java index 201d1e2..4ebf3ac 100644 --- a/src/main/java/com/kusitms/jipbap/notifiication/Notification.java +++ b/src/main/java/com/kusitms/jipbap/notifiication/Notification.java @@ -19,7 +19,7 @@ public class Notification extends DateEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name ="notification_id") + @Column(name ="id") private Long id; //고유 pk @ManyToOne(fetch = FetchType.LAZY) diff --git a/src/main/java/com/kusitms/jipbap/order/Cart.java b/src/main/java/com/kusitms/jipbap/order/Cart.java index ea3b8ae..9fb4996 100644 --- a/src/main/java/com/kusitms/jipbap/order/Cart.java +++ b/src/main/java/com/kusitms/jipbap/order/Cart.java @@ -20,7 +20,7 @@ public class Cart extends DateEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name ="cart_id") + @Column(name ="id") private Long id; //고유 pk @ManyToOne(fetch = FetchType.LAZY) diff --git a/src/main/java/com/kusitms/jipbap/order/Order.java b/src/main/java/com/kusitms/jipbap/order/Order.java index b88046d..4ebac54 100644 --- a/src/main/java/com/kusitms/jipbap/order/Order.java +++ b/src/main/java/com/kusitms/jipbap/order/Order.java @@ -21,7 +21,7 @@ public class Order extends DateEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name ="order_id") + @Column(name ="id") private Long id; //고유 pk @ManyToOne(fetch = FetchType.LAZY) diff --git a/src/main/java/com/kusitms/jipbap/order/Review.java b/src/main/java/com/kusitms/jipbap/order/Review.java index a70ce19..36e2eca 100644 --- a/src/main/java/com/kusitms/jipbap/order/Review.java +++ b/src/main/java/com/kusitms/jipbap/order/Review.java @@ -19,7 +19,7 @@ public class Review extends DateEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name ="review_id") + @Column(name ="id") private Long id; //고유 pk @ManyToOne(fetch = FetchType.LAZY) diff --git a/src/main/java/com/kusitms/jipbap/post/Post.java b/src/main/java/com/kusitms/jipbap/post/Post.java index ad6dc8a..b0b957d 100644 --- a/src/main/java/com/kusitms/jipbap/post/Post.java +++ b/src/main/java/com/kusitms/jipbap/post/Post.java @@ -21,7 +21,7 @@ public class Post extends DateEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name ="post_id") + @Column(name ="id") private Long id; //고유 pk @Enumerated(EnumType.STRING) diff --git a/src/main/java/com/kusitms/jipbap/store/Store.java b/src/main/java/com/kusitms/jipbap/store/Store.java index 6660a89..09feda5 100644 --- a/src/main/java/com/kusitms/jipbap/store/Store.java +++ b/src/main/java/com/kusitms/jipbap/store/Store.java @@ -19,7 +19,7 @@ public class Store extends DateEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name ="store_id") + @Column(name ="id") private Long id; //고유 pk @OneToOne(fetch = FetchType.LAZY) diff --git a/src/main/java/com/kusitms/jipbap/store/StoreBookmark.java b/src/main/java/com/kusitms/jipbap/store/StoreBookmark.java index 54ea80c..34d745e 100644 --- a/src/main/java/com/kusitms/jipbap/store/StoreBookmark.java +++ b/src/main/java/com/kusitms/jipbap/store/StoreBookmark.java @@ -19,7 +19,7 @@ public class StoreBookmark extends DateEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name ="store_bookmark_id") + @Column(name ="id") private Long id; //고유 pk @ManyToOne(fetch = FetchType.LAZY) diff --git a/src/main/java/com/kusitms/jipbap/store/StoreController.java b/src/main/java/com/kusitms/jipbap/store/StoreController.java index 120c990..3b5c27c 100644 --- a/src/main/java/com/kusitms/jipbap/store/StoreController.java +++ b/src/main/java/com/kusitms/jipbap/store/StoreController.java @@ -5,7 +5,6 @@ import com.kusitms.jipbap.security.AuthInfo; import com.kusitms.jipbap.store.dto.RegisterStoreRequestDto; import com.kusitms.jipbap.store.dto.SearchStoreResponseDto; -import com.kusitms.jipbap.store.dto.StoreDto; import io.swagger.v3.oas.annotations.Operation; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.PageRequest; @@ -34,28 +33,28 @@ public CommonResponse registerStore(@Auth AuthInfo authInfo, @Valid @Req /** * 가게 검색 api - 페이지네이션 적용 * @param keyword: 검색 키워드 (키워드가 포함한 가게를 검색한다) - * @param sortField: 검색 기준 (추천-bookmark, 후기-review, 평점-rate, 가격-price, 최신-id) + * @param field: 검색 기준 (추천-bookmark, 후기-review, 평점-rate, 가격-price, 최신-id) * (추천순: 가게 즐겨찾기 개수 순서, 후기: 가게에 속한 주문에 달린 리뷰 수) - * @param sortDirection: 정렬 기준 (ASC, DESC) + * @param direction: 정렬 기준 (ASC, DESC) * @param lastId: 결과 리스트에서 포함되어도 되는 id의 최대값 * @return Slice: 슬라이스 단위 */ - @Operation(summary = "가게 검색") + @Operation(summary = "가게 리스트 검색") @GetMapping public CommonResponse> searchStore( @Auth AuthInfo authInfo, @RequestParam(required = false) String keyword, - @RequestParam String sortField, - @RequestParam String sortDirection, + @RequestParam String field, + @RequestParam String direction, @RequestParam(required = false) Long lastId ) { Sort sort; - if ("asc".equals(sortDirection) || "ASC".equals(sortDirection)) { - sort = Sort.by(Sort.Direction.ASC, sortField); + if ("asc".equals(direction) || "ASC".equals(direction)) { + sort = Sort.by(Sort.Direction.ASC, field); } else { - sort = Sort.by(Sort.Direction.DESC, sortField); + sort = Sort.by(Sort.Direction.DESC, field); } Pageable pageable = PageRequest.of(0, PAGESIZE, sort); - return new CommonResponse<>(storeService.searchStoreList(authInfo.getEmail(), pageable, keyword, sortField, sortDirection, lastId)); + return new CommonResponse<>(storeService.searchStoreList(authInfo.getEmail(), pageable, keyword, field, direction, lastId)); } } diff --git a/src/main/java/com/kusitms/jipbap/user/User.java b/src/main/java/com/kusitms/jipbap/user/User.java index 0a91b37..56a0452 100644 --- a/src/main/java/com/kusitms/jipbap/user/User.java +++ b/src/main/java/com/kusitms/jipbap/user/User.java @@ -19,7 +19,7 @@ public class User extends DateEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name ="user_id") + @Column(name ="id") private Long id; //고유 pk @NotBlank From d3be14b88afad61edcec6a6f4497a6fa7700dc5c Mon Sep 17 00:00:00 2001 From: eckrin Date: Fri, 10 Nov 2023 02:25:28 +0900 Subject: [PATCH 4/4] =?UTF-8?q?feat:=20=ED=8E=98=EC=9D=B4=EC=A7=80?= =?UTF-8?q?=EB=84=A4=EC=9D=B4=EC=85=98=20=EB=B0=A9=EC=8B=9D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 + .../jipbap/common/response/ErrorCode.java | 3 +- .../java/com/kusitms/jipbap/store/Store.java | 9 +-- .../kusitms/jipbap/store/StoreController.java | 22 +++-- .../jipbap/store/StoreExceptionHandler.java | 9 ++- .../kusitms/jipbap/store/StoreRepository.java | 5 ++ .../store/StoreRepositoryExtension.java | 5 +- .../store/StoreRepositoryExtensionImpl.java | 80 +++++++++++-------- .../kusitms/jipbap/store/StoreService.java | 39 +++++++-- .../store/dto/RegisterStoreRequestDto.java | 2 - .../store/dto/SearchStoreResponseDto.java | 22 ----- .../store/dto/StoreDetailResponseDto.java | 14 ++++ .../kusitms/jipbap/store/dto/StoreDto.java | 5 +- .../store/exception/StoreExistsException.java | 7 ++ src/main/resources/application.yml | 2 +- 15 files changed, 144 insertions(+), 83 deletions(-) delete mode 100644 src/main/java/com/kusitms/jipbap/store/dto/SearchStoreResponseDto.java create mode 100644 src/main/java/com/kusitms/jipbap/store/dto/StoreDetailResponseDto.java create mode 100644 src/main/java/com/kusitms/jipbap/store/exception/StoreExistsException.java diff --git a/.gitignore b/.gitignore index d3ef6f2..b06c536 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,6 @@ out/ ### JRebel ### rebel.xml + +### .DS_Store ### +.DS_Store \ No newline at end of file diff --git a/src/main/java/com/kusitms/jipbap/common/response/ErrorCode.java b/src/main/java/com/kusitms/jipbap/common/response/ErrorCode.java index 1b28095..41bb7aa 100644 --- a/src/main/java/com/kusitms/jipbap/common/response/ErrorCode.java +++ b/src/main/java/com/kusitms/jipbap/common/response/ErrorCode.java @@ -27,7 +27,8 @@ public enum ErrorCode { ROOM_NOT_FOUND_ERROR(false, HttpStatus.BAD_REQUEST.value(), "존재하지 않는 채팅방입니다."), //store - STORE_NOT_FOUND_ERROR(false, HttpStatus.BAD_REQUEST.value(), "존재하지 않는 가게입니다."); + STORE_NOT_FOUND_ERROR(false, HttpStatus.BAD_REQUEST.value(), "존재하지 않는 가게입니다."), + STORE_ALREADY_EXISTS_ERROR(false, HttpStatus.BAD_REQUEST.value(), "이미 채팅방을 만든 유저입니다.") ; private Boolean isSuccess; diff --git a/src/main/java/com/kusitms/jipbap/store/Store.java b/src/main/java/com/kusitms/jipbap/store/Store.java index 09feda5..0222a57 100644 --- a/src/main/java/com/kusitms/jipbap/store/Store.java +++ b/src/main/java/com/kusitms/jipbap/store/Store.java @@ -37,14 +37,13 @@ public class Store extends DateEntity { private Boolean koreanYn; //한국인 인증 여부 private Double avgRate; // 가게 평점 - private Long rateCount; // 평점 개수 - private Long bookmarkCount; // 가게 즐겨찾기 횟수 (추천순) - private Long reviewCount; // 가게 후기 개수 - private Long minOrderAmount; //최소 주문 금액 - private String image; + private Long reviewCount; // 가게 후기 개수 + private Long bookmarkCount; // 가게 즐겨찾기 횟수 (추천순) + private Long rateCount; // 평점 남긴 인원수 + public void increaseBookmarkCount() { this.bookmarkCount++; } diff --git a/src/main/java/com/kusitms/jipbap/store/StoreController.java b/src/main/java/com/kusitms/jipbap/store/StoreController.java index 3b5c27c..7d6ce0a 100644 --- a/src/main/java/com/kusitms/jipbap/store/StoreController.java +++ b/src/main/java/com/kusitms/jipbap/store/StoreController.java @@ -4,7 +4,8 @@ import com.kusitms.jipbap.security.Auth; import com.kusitms.jipbap.security.AuthInfo; import com.kusitms.jipbap.store.dto.RegisterStoreRequestDto; -import com.kusitms.jipbap.store.dto.SearchStoreResponseDto; +import com.kusitms.jipbap.store.dto.StoreDetailResponseDto; +import com.kusitms.jipbap.store.dto.StoreDto; import io.swagger.v3.oas.annotations.Operation; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.PageRequest; @@ -25,23 +26,24 @@ public class StoreController { @Operation(summary = "가게 등록하기") @PostMapping - public CommonResponse registerStore(@Auth AuthInfo authInfo, @Valid @RequestBody RegisterStoreRequestDto dto) { - storeService.registerStore(authInfo.getEmail(), dto); - return new CommonResponse<>("가게 등록 완료"); + public CommonResponse registerStore(@Auth AuthInfo authInfo, @Valid @RequestBody RegisterStoreRequestDto dto) { + return new CommonResponse<>(storeService.registerStore(authInfo.getEmail(), dto)); } /** * 가게 검색 api - 페이지네이션 적용 + * api의 복잡도와 성능을 희생하는 대신, 데이터 중복/삭제 현상을 감안함 + * * @param keyword: 검색 키워드 (키워드가 포함한 가게를 검색한다) * @param field: 검색 기준 (추천-bookmark, 후기-review, 평점-rate, 가격-price, 최신-id) * (추천순: 가게 즐겨찾기 개수 순서, 후기: 가게에 속한 주문에 달린 리뷰 수) * @param direction: 정렬 기준 (ASC, DESC) - * @param lastId: 결과 리스트에서 포함되어도 되는 id의 최대값 + * @param lastId: 결과 리스트에서 마지막으로 출력된 가게의 id * @return Slice: 슬라이스 단위 */ @Operation(summary = "가게 리스트 검색") @GetMapping - public CommonResponse> searchStore( + public CommonResponse> searchStore( @Auth AuthInfo authInfo, @RequestParam(required = false) String keyword, @RequestParam String field, @@ -57,4 +59,12 @@ public CommonResponse> searchStore( Pageable pageable = PageRequest.of(0, PAGESIZE, sort); return new CommonResponse<>(storeService.searchStoreList(authInfo.getEmail(), pageable, keyword, field, direction, lastId)); } + + + @Operation(summary = "가게 상세정보") + @GetMapping("/{storeId}") + public CommonResponse storeDetail(@Auth AuthInfo authInfo, @PathVariable Long storeId) { + return new CommonResponse<>(storeService.getStoreDetail(authInfo.getEmail(), storeId)); + } + } diff --git a/src/main/java/com/kusitms/jipbap/store/StoreExceptionHandler.java b/src/main/java/com/kusitms/jipbap/store/StoreExceptionHandler.java index 3d05cf6..e0d45a3 100644 --- a/src/main/java/com/kusitms/jipbap/store/StoreExceptionHandler.java +++ b/src/main/java/com/kusitms/jipbap/store/StoreExceptionHandler.java @@ -2,6 +2,7 @@ import com.kusitms.jipbap.common.response.CommonResponse; import com.kusitms.jipbap.common.response.ErrorCode; +import com.kusitms.jipbap.store.exception.StoreExistsException; import com.kusitms.jipbap.store.exception.StoreNotExistsException; import jakarta.servlet.http.HttpServletRequest; import lombok.extern.slf4j.Slf4j; @@ -17,7 +18,13 @@ public class StoreExceptionHandler { @ResponseStatus(HttpStatus.BAD_REQUEST) public CommonResponse handleStoreNotExistsException(StoreNotExistsException e, HttpServletRequest request) { log.warn("STORE-001> 요청 URI: " + request.getRequestURI() + ", 에러 메세지: " + e.getMessage()); - return new CommonResponse<>(ErrorCode.ROOM_NOT_FOUND_ERROR); + return new CommonResponse<>(ErrorCode.STORE_NOT_FOUND_ERROR); } + @ExceptionHandler(StoreExistsException.class) + @ResponseStatus(HttpStatus.BAD_REQUEST) + public CommonResponse handleStoreExistsException(StoreExistsException e, HttpServletRequest request) { + log.warn("STORE-002> 요청 URI: " + request.getRequestURI() + ", 에러 메세지: " + e.getMessage()); + return new CommonResponse<>(ErrorCode.STORE_ALREADY_EXISTS_ERROR); + } } diff --git a/src/main/java/com/kusitms/jipbap/store/StoreRepository.java b/src/main/java/com/kusitms/jipbap/store/StoreRepository.java index 0633d54..a4d6653 100644 --- a/src/main/java/com/kusitms/jipbap/store/StoreRepository.java +++ b/src/main/java/com/kusitms/jipbap/store/StoreRepository.java @@ -1,6 +1,11 @@ package com.kusitms.jipbap.store; +import com.kusitms.jipbap.user.User; import org.springframework.data.jpa.repository.JpaRepository; +import java.util.Optional; + public interface StoreRepository extends JpaRepository, StoreRepositoryExtension { + Optional findById(Long id); + Boolean existsByOwner(User user); } diff --git a/src/main/java/com/kusitms/jipbap/store/StoreRepositoryExtension.java b/src/main/java/com/kusitms/jipbap/store/StoreRepositoryExtension.java index fc2b6d4..8d00fc1 100644 --- a/src/main/java/com/kusitms/jipbap/store/StoreRepositoryExtension.java +++ b/src/main/java/com/kusitms/jipbap/store/StoreRepositoryExtension.java @@ -1,12 +1,11 @@ package com.kusitms.jipbap.store; -import com.kusitms.jipbap.store.dto.SearchStoreResponseDto; -import com.kusitms.jipbap.store.dto.StoreDto; +import com.kusitms.jipbap.store.dto.StoreDetailResponseDto; import com.kusitms.jipbap.user.User; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Slice; public interface StoreRepositoryExtension { - Slice searchByKeywordOrderBySort(User user, Pageable pageable, String keyword, String standard, String order, Long lastId); + Slice searchByKeywordOrderBySort(User user, Pageable pageable, String keyword, String standard, String order, Long lastId); } diff --git a/src/main/java/com/kusitms/jipbap/store/StoreRepositoryExtensionImpl.java b/src/main/java/com/kusitms/jipbap/store/StoreRepositoryExtensionImpl.java index f602792..7ebcb2f 100644 --- a/src/main/java/com/kusitms/jipbap/store/StoreRepositoryExtensionImpl.java +++ b/src/main/java/com/kusitms/jipbap/store/StoreRepositoryExtensionImpl.java @@ -1,7 +1,8 @@ package com.kusitms.jipbap.store; import com.kusitms.jipbap.common.QueryDslUtil; -import com.kusitms.jipbap.store.dto.SearchStoreResponseDto; +import com.kusitms.jipbap.store.dto.StoreDetailResponseDto; +import com.kusitms.jipbap.store.dto.StoreDto; import com.kusitms.jipbap.user.User; import com.querydsl.core.types.Order; import com.querydsl.core.types.OrderSpecifier; @@ -16,6 +17,7 @@ import java.util.ArrayList; import java.util.List; +import static com.kusitms.jipbap.store.QStore.*; import static com.kusitms.jipbap.store.QStore.store; import static org.springframework.util.ObjectUtils.isEmpty; @@ -26,32 +28,33 @@ public class StoreRepositoryExtensionImpl implements StoreRepositoryExtension{ private final StoreBookmarkRepository storeBookmarkRepository; @Override - public Slice searchByKeywordOrderBySort(User user, Pageable pageable, String keyword, String standard, String order, Long lastId) { + public Slice searchByKeywordOrderBySort(User user, Pageable pageable, String keyword, String standard, String order, Long lastId) { - List orderSpecifiers = getAllOrderSpecifiers(pageable); + List> orderSpecifiers = getAllOrderSpecifiers(pageable); List storeList = queryFactory.selectFrom(store) .where( - ltId(lastId), + lastStore(pageable, lastId), containsKeyword(keyword) ) .limit(pageable.getPageSize()+1) .orderBy(orderSpecifiers.toArray(OrderSpecifier[]::new)) .fetch(); - List dtoList = new ArrayList<>(); + List dtoList = new ArrayList<>(); for(Store s: storeList) { - dtoList.add(new SearchStoreResponseDto( - s.getId(), - s.getName(), - s.getDescription(), - s.getKoreanYn(), - s.getAvgRate(), - s.getMinOrderAmount(), - s.getImage(), - isUserBookmarkedStore(user, s), - getLastId(lastId) + dtoList.add(new StoreDetailResponseDto( + new StoreDto( + s.getId(), + s.getName(), + s.getDescription(), + s.getKoreanYn(), + s.getAvgRate(), + s.getMinOrderAmount(), + s.getImage() + ), + isUserBookmarkedStore(user, s) )); } @@ -65,29 +68,35 @@ public Slice searchByKeywordOrderBySort(User user, Pagea return new SliceImpl<>(dtoList, pageable, hasNext); } - // lastId가 null이라면 현재 가장 마지막에 추가된 store id 반환 - private Long getLastId(Long lastId) { - if(lastId == null) { - return queryFactory.select(store.id) - .from(store) - .limit(1) - .orderBy(store.id.desc()) - .fetchFirst(); - } - return lastId; - } - // user가 즐겨찾기한 store인지 검사 private Boolean isUserBookmarkedStore(User user, Store store) { return storeBookmarkRepository.existsByUserAndStore(user, store); } // no-offset 방식 처리하는 메서드 - private BooleanExpression ltId(Long id) { - if(id == null) { - return null; + // 정렬조건에 따라서 다음에 나와야 할 친구들을 구함 + private BooleanExpression lastStore(Pageable pageable, Long id) { + if(id==null) return null; + + Store stdStore = queryFactory.selectFrom(QStore.store) + .where(QStore.store.id.eq(id)) + .fetchFirst(); + + for (Sort.Order order : pageable.getSort()) { + return switch (order.getProperty()) { + case "bookmark" -> // 추천순 + store.bookmarkCount.lt(stdStore.getBookmarkCount()); + case "review" -> // 후기순 + store.reviewCount.lt(stdStore.getReviewCount()); + case "rate" -> // 평점순 + store.rateCount.lt(stdStore.getRateCount()); + case "id" -> // 최신순 + store.id.lt(stdStore.getId()); + default -> null; + }; } - return store.id.lt(id); + + return null; } private BooleanExpression containsKeyword(String keyword) { @@ -97,9 +106,9 @@ private BooleanExpression containsKeyword(String keyword) { return store.name.contains(keyword); } - private List getAllOrderSpecifiers(Pageable pageable) { + private List> getAllOrderSpecifiers(Pageable pageable) { - List orderSpecifierList = new ArrayList<>(); + List> orderSpecifierList = new ArrayList<>(); if (!isEmpty(pageable.getSort())) { for (Sort.Order order : pageable.getSort()) { @@ -108,12 +117,15 @@ private List getAllOrderSpecifiers(Pageable pageable) { // 기본 정렬조건: 추천순 case "bookmark": // 추천순 orderSpecifierList.add(QueryDslUtil.getSortedColumn(direction, store, "bookmarkCount")); + orderSpecifierList.add(QueryDslUtil.getSortedColumn(Order.DESC, store, "id")); break; case "review": // 후기순 orderSpecifierList.add(QueryDslUtil.getSortedColumn(direction, store, "reviewCount")); + orderSpecifierList.add(QueryDslUtil.getSortedColumn(Order.DESC, store, "id")); break; case "rate": // 평점순 orderSpecifierList.add(QueryDslUtil.getSortedColumn(direction, store, "avgRate")); + orderSpecifierList.add(QueryDslUtil.getSortedColumn(Order.DESC, store, "id")); break; case "id": // 최신순 orderSpecifierList.add(QueryDslUtil.getSortedColumn(direction, store, "id")); @@ -126,4 +138,4 @@ private List getAllOrderSpecifiers(Pageable pageable) { return orderSpecifierList; } -} +} \ No newline at end of file diff --git a/src/main/java/com/kusitms/jipbap/store/StoreService.java b/src/main/java/com/kusitms/jipbap/store/StoreService.java index 9e6dfa3..5926249 100644 --- a/src/main/java/com/kusitms/jipbap/store/StoreService.java +++ b/src/main/java/com/kusitms/jipbap/store/StoreService.java @@ -1,8 +1,10 @@ package com.kusitms.jipbap.store; import com.kusitms.jipbap.store.dto.RegisterStoreRequestDto; -import com.kusitms.jipbap.store.dto.SearchStoreResponseDto; +import com.kusitms.jipbap.store.dto.StoreDetailResponseDto; import com.kusitms.jipbap.store.dto.StoreDto; +import com.kusitms.jipbap.store.exception.StoreExistsException; +import com.kusitms.jipbap.store.exception.StoreNotExistsException; import com.kusitms.jipbap.user.User; import com.kusitms.jipbap.user.UserRepository; import com.kusitms.jipbap.user.exception.UserNotFoundException; @@ -19,23 +21,48 @@ public class StoreService { private final StoreRepository storeRepository; + private final StoreBookmarkRepository storeBookmarkRepository; private final UserRepository userRepository; @Transactional - public void registerStore(String email, RegisterStoreRequestDto dto) { + public StoreDto registerStore(String email, RegisterStoreRequestDto dto) { User user = userRepository.findByEmail(email).orElseThrow(()-> new UserNotFoundException("유저 정보가 존재하지 않습니다.")); - storeRepository.save( - new Store(null, user, dto.getName(), dto.getDescription(), dto.getKoreanYn(), 0D, 0L, 0L, 0L, dto.getMinOrderAmount(), null) + if(storeRepository.existsByOwner(user)) { + throw new StoreExistsException("이미 가게를 생성한 유저입니다."); + } + Store store = storeRepository.save( + new Store(null, user, dto.getName(), dto.getDescription(), dto.getKoreanYn(), 0D, dto.getMinOrderAmount(),null, 0L, 0L, 0L) ); - + return new StoreDto(store.getId(), store.getName(), store.getDescription(), store.getKoreanYn(), store.getAvgRate(), store.getBookmarkCount(), store.getImage()); } @Transactional - public Slice searchStoreList(String email, Pageable pageable, String keyword, String standard, String order, Long lastId) { + public Slice searchStoreList(String email, Pageable pageable, String keyword, String standard, String order, Long lastId) { User user = userRepository.findByEmail(email).orElseThrow(()-> new UserNotFoundException("유저 정보가 존재하지 않습니다.")); return storeRepository.searchByKeywordOrderBySort(user, pageable, keyword, standard, order, lastId); } + @Transactional + public StoreDetailResponseDto getStoreDetail(String email, Long storeId) { + User user = userRepository.findByEmail(email).orElseThrow(()-> new UserNotFoundException("유저 정보가 존재하지 않습니다.")); + Store store = storeRepository.findById(storeId).orElseThrow(()-> new StoreNotExistsException("storeId: "+storeId+"에 해당하는 가게가 존재하지 않습니다.")); + return new StoreDetailResponseDto( + new StoreDto( + store.getId(), + store.getName(), + store.getDescription(), + store.getKoreanYn(), + store.getAvgRate(), + store.getMinOrderAmount(), + store.getImage() + ), + isStoreBookmarked(user, store) + ); + } + + private Boolean isStoreBookmarked(User user, Store store){ + return storeBookmarkRepository.existsByUserAndStore(user, store); + } } diff --git a/src/main/java/com/kusitms/jipbap/store/dto/RegisterStoreRequestDto.java b/src/main/java/com/kusitms/jipbap/store/dto/RegisterStoreRequestDto.java index 73cbb56..192a44d 100644 --- a/src/main/java/com/kusitms/jipbap/store/dto/RegisterStoreRequestDto.java +++ b/src/main/java/com/kusitms/jipbap/store/dto/RegisterStoreRequestDto.java @@ -7,10 +7,8 @@ @Setter public class RegisterStoreRequestDto { - private Long userId; private String name; private String description; private Boolean koreanYn; - private Long minOrderAmount; } diff --git a/src/main/java/com/kusitms/jipbap/store/dto/SearchStoreResponseDto.java b/src/main/java/com/kusitms/jipbap/store/dto/SearchStoreResponseDto.java deleted file mode 100644 index d54a3b3..0000000 --- a/src/main/java/com/kusitms/jipbap/store/dto/SearchStoreResponseDto.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.kusitms.jipbap.store.dto; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -public class SearchStoreResponseDto { - - private Long id; - private String name; - private String description; - private Boolean koreanYn; - private Double avgRate; - private Long minOrderAmount; - private String image; - - private Boolean isBookmarked; - private Long lastId; -} diff --git a/src/main/java/com/kusitms/jipbap/store/dto/StoreDetailResponseDto.java b/src/main/java/com/kusitms/jipbap/store/dto/StoreDetailResponseDto.java new file mode 100644 index 0000000..7e0c4f7 --- /dev/null +++ b/src/main/java/com/kusitms/jipbap/store/dto/StoreDetailResponseDto.java @@ -0,0 +1,14 @@ +package com.kusitms.jipbap.store.dto; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +public class StoreDetailResponseDto { + + private StoreDto storeDto; + private Boolean isBookmarked; +} diff --git a/src/main/java/com/kusitms/jipbap/store/dto/StoreDto.java b/src/main/java/com/kusitms/jipbap/store/dto/StoreDto.java index 7e30af3..f834b94 100644 --- a/src/main/java/com/kusitms/jipbap/store/dto/StoreDto.java +++ b/src/main/java/com/kusitms/jipbap/store/dto/StoreDto.java @@ -6,13 +6,14 @@ @Getter @Setter +@AllArgsConstructor public class StoreDto { private Long id; private String name; private String description; private Boolean koreanYn; - private Double avgRate; - private Long bookmarkCount; + private Double avgRate; // 가게 평점 + private Long minOrderAmount; //최소 주문 금액 private String image; } diff --git a/src/main/java/com/kusitms/jipbap/store/exception/StoreExistsException.java b/src/main/java/com/kusitms/jipbap/store/exception/StoreExistsException.java new file mode 100644 index 0000000..e772fc9 --- /dev/null +++ b/src/main/java/com/kusitms/jipbap/store/exception/StoreExistsException.java @@ -0,0 +1,7 @@ +package com.kusitms.jipbap.store.exception; + +public class StoreExistsException extends RuntimeException{ + public StoreExistsException(String message) { + super(message); + } +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 3a1625f..cc2af70 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -22,7 +22,7 @@ spring: jpa: open-in-view: true hibernate: - ddl-auto: create + ddl-auto: create-drop show-sql: true properties: hibernate: