From d0c42a9c95943d14a5447464d086dbd9708fda0e Mon Sep 17 00:00:00 2001 From: sojungpp Date: Sat, 22 Jul 2023 04:27:07 +0900 Subject: [PATCH] =?UTF-8?q?#1=20feat:=20DB=20=EC=BB=AC=EB=9F=BC=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/psr/psr/chat/entity/ChatRoom.kt | 17 +++++++--- src/main/kotlin/com/psr/psr/cs/entity/Faq.kt | 13 ++++++- .../kotlin/com/psr/psr/cs/entity/Notice.kt | 12 ++++++- .../com/psr/psr/inquiry/entity/Inquiry.kt | 25 +++++++++++--- .../psr/notification/entity/Notification.kt | 10 +++++- .../kotlin/com/psr/psr/order/entity/Order.kt | 34 ++++++++++++++++--- .../psr/psr/product/entity/product/Product.kt | 28 ++++++++++++--- .../psr/product/entity/product/ProductImg.kt | 11 +++++- .../psr/product/entity/product/ProductLike.kt | 16 ++++++--- .../product/entity/product/ProductReport.kt | 22 +++++++++--- .../psr/psr/product/entity/review/Review.kt | 26 ++++++++++---- .../psr/product/entity/review/ReviewReport.kt | 23 +++++++++---- .../com/psr/psr/user/entity/BusinessInfo.kt | 24 ++++++++++--- .../kotlin/com/psr/psr/user/entity/User.kt | 22 +++++++++++- .../com/psr/psr/user/entity/UserInterest.kt | 16 ++++++--- 15 files changed, 242 insertions(+), 57 deletions(-) diff --git a/src/main/kotlin/com/psr/psr/chat/entity/ChatRoom.kt b/src/main/kotlin/com/psr/psr/chat/entity/ChatRoom.kt index 30bf2f2..5fa91a5 100644 --- a/src/main/kotlin/com/psr/psr/chat/entity/ChatRoom.kt +++ b/src/main/kotlin/com/psr/psr/chat/entity/ChatRoom.kt @@ -1,13 +1,20 @@ package com.psr.psr.chat.entity import com.psr.psr.global.entity.BaseEntity -import jakarta.persistence.Entity -import jakarta.persistence.GeneratedValue -import jakarta.persistence.GenerationType -import jakarta.persistence.Id +import com.psr.psr.user.entity.User +import jakarta.persistence.* @Entity data class ChatRoom( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - var id: Long + var id: Long, + + @ManyToOne + @JoinColumn(nullable = false, name = "sender_user_idx") + var senderUser: User, + + @ManyToOne + @JoinColumn(nullable = false, name = "receiver_user_idx") + var receiverUser: User + ): BaseEntity() diff --git a/src/main/kotlin/com/psr/psr/cs/entity/Faq.kt b/src/main/kotlin/com/psr/psr/cs/entity/Faq.kt index 0598810..4c21416 100644 --- a/src/main/kotlin/com/psr/psr/cs/entity/Faq.kt +++ b/src/main/kotlin/com/psr/psr/cs/entity/Faq.kt @@ -5,9 +5,20 @@ import jakarta.persistence.Entity import jakarta.persistence.GeneratedValue import jakarta.persistence.GenerationType import jakarta.persistence.Id +import org.jetbrains.annotations.NotNull @Entity data class Faq( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - var id: Long + var id: Long, + + @NotNull + var title: String, + + @NotNull + var content: String, + + @NotNull + var type: FaqType + ): BaseEntity() diff --git a/src/main/kotlin/com/psr/psr/cs/entity/Notice.kt b/src/main/kotlin/com/psr/psr/cs/entity/Notice.kt index 851b22c..3a27d60 100644 --- a/src/main/kotlin/com/psr/psr/cs/entity/Notice.kt +++ b/src/main/kotlin/com/psr/psr/cs/entity/Notice.kt @@ -5,9 +5,19 @@ import jakarta.persistence.Entity import jakarta.persistence.GeneratedValue import jakarta.persistence.GenerationType import jakarta.persistence.Id +import org.jetbrains.annotations.NotNull @Entity data class Notice( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - var id: Long + var id: Long, + + @NotNull + var title: String, + + @NotNull + var content: String, + + var imgKey: String + ): BaseEntity() diff --git a/src/main/kotlin/com/psr/psr/inquiry/entity/Inquiry.kt b/src/main/kotlin/com/psr/psr/inquiry/entity/Inquiry.kt index edf52bd..997b456 100644 --- a/src/main/kotlin/com/psr/psr/inquiry/entity/Inquiry.kt +++ b/src/main/kotlin/com/psr/psr/inquiry/entity/Inquiry.kt @@ -1,13 +1,28 @@ package com.psr.psr.inquiry.entity import com.psr.psr.global.entity.BaseEntity -import jakarta.persistence.Entity -import jakarta.persistence.GeneratedValue -import jakarta.persistence.GenerationType -import jakarta.persistence.Id +import com.psr.psr.user.entity.User +import jakarta.persistence.* +import org.jetbrains.annotations.NotNull @Entity data class Inquiry( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - var id: Long + var id: Long, + + @ManyToOne + @JoinColumn(nullable = false, name = "user_idx") + var user: User, + + @NotNull + var title: String, + + @NotNull + var content: String, + + @NotNull + var inquiryStatus: InquiryStatus, + + var answer: String + ): BaseEntity() diff --git a/src/main/kotlin/com/psr/psr/notification/entity/Notification.kt b/src/main/kotlin/com/psr/psr/notification/entity/Notification.kt index 16606c9..f8eccd7 100644 --- a/src/main/kotlin/com/psr/psr/notification/entity/Notification.kt +++ b/src/main/kotlin/com/psr/psr/notification/entity/Notification.kt @@ -5,9 +5,17 @@ import jakarta.persistence.Entity import jakarta.persistence.GeneratedValue import jakarta.persistence.GenerationType import jakarta.persistence.Id +import org.jetbrains.annotations.NotNull @Entity data class Notification( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - var id: Long + var id: Long, + + @NotNull + var title: String, + + @NotNull + var content: String + ): BaseEntity() diff --git a/src/main/kotlin/com/psr/psr/order/entity/Order.kt b/src/main/kotlin/com/psr/psr/order/entity/Order.kt index 53f282d..367bc34 100644 --- a/src/main/kotlin/com/psr/psr/order/entity/Order.kt +++ b/src/main/kotlin/com/psr/psr/order/entity/Order.kt @@ -1,13 +1,37 @@ package com.psr.psr.order.entity import com.psr.psr.global.entity.BaseEntity -import jakarta.persistence.Entity -import jakarta.persistence.GeneratedValue -import jakarta.persistence.GenerationType -import jakarta.persistence.Id +import com.psr.psr.product.entity.product.Product +import com.psr.psr.user.entity.User +import jakarta.persistence.* +import org.jetbrains.annotations.NotNull @Entity data class Order( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - var id: Long + var id: Long, + + @ManyToOne + @JoinColumn(nullable = false, name = "product_idx") + var product: Product, + + @ManyToOne + @JoinColumn(nullable = false, name = "user_idx") + var user: User, + + @NotNull + var ordererName: String, + + @NotNull + var websiteUrl: String, + + @NotNull + var orderStatus: OrderStatus, + + @NotNull + var inquiry: String, + + @NotNull + var description: String + ): BaseEntity() diff --git a/src/main/kotlin/com/psr/psr/product/entity/product/Product.kt b/src/main/kotlin/com/psr/psr/product/entity/product/Product.kt index e8fcb2c..5c72c62 100644 --- a/src/main/kotlin/com/psr/psr/product/entity/product/Product.kt +++ b/src/main/kotlin/com/psr/psr/product/entity/product/Product.kt @@ -1,13 +1,31 @@ package com.psr.psr.product.entity.product import com.psr.psr.global.entity.BaseEntity -import jakarta.persistence.Entity -import jakarta.persistence.GeneratedValue -import jakarta.persistence.GenerationType -import jakarta.persistence.Id +import com.psr.psr.user.entity.Category +import com.psr.psr.user.entity.User +import jakarta.persistence.* +import org.jetbrains.annotations.NotNull @Entity data class Product( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - var id: Long + var id: Long, + + @ManyToOne + @JoinColumn(nullable = false, name = "user_idx") + var user: User, + + @NotNull + var name: String, + + @NotNull + var category: Category, + + @NotNull + var price: Int, + + @NotNull + var description: String, + + var likeNum: Int ): BaseEntity() diff --git a/src/main/kotlin/com/psr/psr/product/entity/product/ProductImg.kt b/src/main/kotlin/com/psr/psr/product/entity/product/ProductImg.kt index 1656fa0..25656d0 100644 --- a/src/main/kotlin/com/psr/psr/product/entity/product/ProductImg.kt +++ b/src/main/kotlin/com/psr/psr/product/entity/product/ProductImg.kt @@ -5,9 +5,18 @@ import jakarta.persistence.Entity import jakarta.persistence.GeneratedValue import jakarta.persistence.GenerationType import jakarta.persistence.Id +import jakarta.persistence.ManyToOne +import org.jetbrains.annotations.NotNull @Entity data class ProductImg( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - var id: Long + var id: Long, + + @ManyToOne + var product: Product, + + @NotNull + var imgKey: String + ): BaseEntity() diff --git a/src/main/kotlin/com/psr/psr/product/entity/product/ProductLike.kt b/src/main/kotlin/com/psr/psr/product/entity/product/ProductLike.kt index 72de456..65758f2 100644 --- a/src/main/kotlin/com/psr/psr/product/entity/product/ProductLike.kt +++ b/src/main/kotlin/com/psr/psr/product/entity/product/ProductLike.kt @@ -1,13 +1,19 @@ package com.psr.psr.product.entity.product import com.psr.psr.global.entity.BaseEntity -import jakarta.persistence.Entity -import jakarta.persistence.GeneratedValue -import jakarta.persistence.GenerationType -import jakarta.persistence.Id +import com.psr.psr.user.entity.User +import jakarta.persistence.* @Entity data class ProductLike( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - var id: Long + var id: Long, + + @ManyToOne + @JoinColumn(nullable = false, name = "product_idx") + var product: Product, + + @ManyToOne + @JoinColumn(nullable = false, name = "user_idx") + var user: User ): BaseEntity() diff --git a/src/main/kotlin/com/psr/psr/product/entity/product/ProductReport.kt b/src/main/kotlin/com/psr/psr/product/entity/product/ProductReport.kt index 316a48c..6df0b0f 100644 --- a/src/main/kotlin/com/psr/psr/product/entity/product/ProductReport.kt +++ b/src/main/kotlin/com/psr/psr/product/entity/product/ProductReport.kt @@ -1,13 +1,25 @@ package com.psr.psr.product.entity.product import com.psr.psr.global.entity.BaseEntity -import jakarta.persistence.Entity -import jakarta.persistence.GeneratedValue -import jakarta.persistence.GenerationType -import jakarta.persistence.Id +import com.psr.psr.product.entity.ReportCategory +import com.psr.psr.user.entity.User +import jakarta.persistence.* +import org.jetbrains.annotations.NotNull @Entity data class ProductReport( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - var id: Long + var id: Long, + + @ManyToOne + @JoinColumn(nullable = false, name = "product_idx") + var product: Product, + + @ManyToOne + @JoinColumn(nullable = false, name = "user_idx") + var user: User, + + @NotNull + var category: ReportCategory + ): BaseEntity() diff --git a/src/main/kotlin/com/psr/psr/product/entity/review/Review.kt b/src/main/kotlin/com/psr/psr/product/entity/review/Review.kt index 79c177f..536233d 100644 --- a/src/main/kotlin/com/psr/psr/product/entity/review/Review.kt +++ b/src/main/kotlin/com/psr/psr/product/entity/review/Review.kt @@ -1,13 +1,27 @@ package com.psr.psr.product.entity.review import com.psr.psr.global.entity.BaseEntity -import jakarta.persistence.Entity -import jakarta.persistence.GeneratedValue -import jakarta.persistence.GenerationType -import jakarta.persistence.Id +import com.psr.psr.product.entity.product.Product +import com.psr.psr.user.entity.User +import jakarta.persistence.* +import org.jetbrains.annotations.NotNull @Entity data class Review( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - var id: Long -): BaseEntity() + var id: Long, + + @ManyToOne + @JoinColumn(nullable = false, name = "product_idx") + var product: Product, + + @ManyToOne + @JoinColumn(nullable = false, name = "user_idx") + var user: User, + + @NotNull + var rating: Int, + + var content: String + + ): BaseEntity() diff --git a/src/main/kotlin/com/psr/psr/product/entity/review/ReviewReport.kt b/src/main/kotlin/com/psr/psr/product/entity/review/ReviewReport.kt index d4d0c26..e4ebc03 100644 --- a/src/main/kotlin/com/psr/psr/product/entity/review/ReviewReport.kt +++ b/src/main/kotlin/com/psr/psr/product/entity/review/ReviewReport.kt @@ -1,13 +1,24 @@ package com.psr.psr.product.entity.review import com.psr.psr.global.entity.BaseEntity -import jakarta.persistence.Entity -import jakarta.persistence.GeneratedValue -import jakarta.persistence.GenerationType -import jakarta.persistence.Id +import com.psr.psr.product.entity.ReportCategory +import com.psr.psr.user.entity.User +import jakarta.persistence.* @Entity data class ReviewReport( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - var id: Long -): BaseEntity() + var id: Long, + + @ManyToOne + @JoinColumn(nullable = false, name = "review_idx") + var review: Review, + + @ManyToOne + @JoinColumn(nullable = false, name = "user_idx") + var user: User, + + var category: ReportCategory + + + ): BaseEntity() diff --git a/src/main/kotlin/com/psr/psr/user/entity/BusinessInfo.kt b/src/main/kotlin/com/psr/psr/user/entity/BusinessInfo.kt index 9b8caa3..ed42a2e 100644 --- a/src/main/kotlin/com/psr/psr/user/entity/BusinessInfo.kt +++ b/src/main/kotlin/com/psr/psr/user/entity/BusinessInfo.kt @@ -1,13 +1,27 @@ package com.psr.psr.user.entity import com.psr.psr.global.entity.BaseEntity -import jakarta.persistence.Entity -import jakarta.persistence.GeneratedValue -import jakarta.persistence.GenerationType -import jakarta.persistence.Id +import jakarta.persistence.* +import org.jetbrains.annotations.NotNull @Entity data class BusinessInfo( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - var id: Long + var id: Long, + + @OneToOne + @JoinColumn(nullable = false, name = "user_idx") + var user: User, + + @NotNull + var companyName: String, + + @NotNull + var ownerName: String, + + @NotNull + var number: String, + + @NotNull + var address: String ): BaseEntity() diff --git a/src/main/kotlin/com/psr/psr/user/entity/User.kt b/src/main/kotlin/com/psr/psr/user/entity/User.kt index 27eb049..82fe041 100644 --- a/src/main/kotlin/com/psr/psr/user/entity/User.kt +++ b/src/main/kotlin/com/psr/psr/user/entity/User.kt @@ -16,6 +16,26 @@ data class User( var email: String, @NotNull - var password:String + var password:String, + + @NotNull + var type:Type, + + @NotNull + var nickname:String, + + @NotNull + var phone:String, + + var profileImgKey: String, + + @NotNull + var provider: Provider, + + @NotNull + var marketing: Boolean, + + @NotNull + var notification: Boolean ): BaseEntity() diff --git a/src/main/kotlin/com/psr/psr/user/entity/UserInterest.kt b/src/main/kotlin/com/psr/psr/user/entity/UserInterest.kt index 24664b9..ac6a4f9 100644 --- a/src/main/kotlin/com/psr/psr/user/entity/UserInterest.kt +++ b/src/main/kotlin/com/psr/psr/user/entity/UserInterest.kt @@ -1,13 +1,19 @@ package com.psr.psr.user.entity import com.psr.psr.global.entity.BaseEntity -import jakarta.persistence.Entity -import jakarta.persistence.GeneratedValue -import jakarta.persistence.GenerationType -import jakarta.persistence.Id +import jakarta.persistence.* +import org.jetbrains.annotations.NotNull @Entity data class UserInterest( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - var id: Long + var id: Long, + + @ManyToOne + @JoinColumn(nullable = false, name = "user_idx") + var user: User, + + @NotNull + var category: Category + ): BaseEntity()