Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] DB 생성 #10

Merged
merged 10 commits into from
Jul 23, 2023
17 changes: 12 additions & 5 deletions src/main/kotlin/com/psr/psr/chat/entity/ChatRoom.kt
Original file line number Diff line number Diff line change
@@ -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_id")
var senderUser: User,

@ManyToOne
@JoinColumn(nullable = false, name = "receiver_user_id")
var receiverUser: User

): BaseEntity()
20 changes: 15 additions & 5 deletions src/main/kotlin/com/psr/psr/cs/entity/Faq.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
package com.psr.psr.cs.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 Faq(
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
var id: Long
var id: Long,

@NotNull
@Column(length = 100)
var title: String,

@NotNull
var content: String,

@NotNull
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enum 쓴 부분은 @Enumerated(EnumType.STRING)가 필요할 것 같습니다!
지금 DB에는 tinyint로 되어있어용

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

감사합니당당 수정완!!

@Enumerated(EnumType.STRING)
var type: FaqType

): BaseEntity()
7 changes: 7 additions & 0 deletions src/main/kotlin/com/psr/psr/cs/entity/FaqType.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.psr.psr.cs.entity

enum class FaqType(val value: String) {
ACCOUNT_MANAGEMENT("계정관리"),
CONSULTING("컨설팅"),
PRODUCT("상품")
}
15 changes: 14 additions & 1 deletion src/main/kotlin/com/psr/psr/cs/entity/Notice.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
package com.psr.psr.cs.entity

import com.psr.psr.global.entity.BaseEntity
import jakarta.persistence.Column
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
@Column(length = 100)
var title: String,

@NotNull
@Column(length = 500)
var content: String,

var imgKey: String
sojungpp marked this conversation as resolved.
Show resolved Hide resolved

): BaseEntity()
27 changes: 22 additions & 5 deletions src/main/kotlin/com/psr/psr/inquiry/entity/Inquiry.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
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_id")
var user: User,

@NotNull
@Column(length = 100)
var title: String,

@NotNull
var content: String,

@NotNull
@Enumerated(EnumType.STRING)
var inquiryStatus: InquiryStatus,

var answer: String
sojungpp marked this conversation as resolved.
Show resolved Hide resolved

): BaseEntity()
6 changes: 6 additions & 0 deletions src/main/kotlin/com/psr/psr/inquiry/entity/InquiryStatus.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.psr.psr.inquiry.entity

enum class InquiryStatus(val value: String) {
PROGRESSING("진행중"),
COMPLETED("완료")
}
16 changes: 11 additions & 5 deletions src/main/kotlin/com/psr/psr/notification/entity/Notification.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
package com.psr.psr.notification.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 Notification(
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
var id: Long
var id: Long,

@NotNull
@Column(length = 100)
var title: String,

@NotNull
var content: String

): BaseEntity()
36 changes: 31 additions & 5 deletions src/main/kotlin/com/psr/psr/order/entity/Order.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,39 @@
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_id")
var product: Product,

@ManyToOne
@JoinColumn(nullable = false, name = "user_id")
var user: User,

@NotNull
@Column(length = 100)
var ordererName: String,

@NotNull
var websiteUrl: String,

@NotNull
@Enumerated(EnumType.STRING)
var orderStatus: OrderStatus,

@NotNull
var inquiry: String,

@NotNull
var description: String

): BaseEntity()
8 changes: 8 additions & 0 deletions src/main/kotlin/com/psr/psr/order/entity/OrderStatus.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.psr.psr.order.entity

enum class OrderStatus(val value: String) {
ORDER_WAITING("요청대기"),
PROGRESSING("진행중"),
COMPLETED("진행완료"),
CANCELED("요청취소")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.psr.psr.product.entity

enum class ReportCategory(val value: String) {
JUNK("스팸홍보/도배"),
ABUSE("욕설/혐오/차별"),
PORN("음란물/유해한 정보"),
FRAUD("사기/불법정보"),
NOT_FIT("게시글 성격에 부적합함")
}
31 changes: 26 additions & 5 deletions src/main/kotlin/com/psr/psr/product/entity/product/Product.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,34 @@
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_id")
var user: User,

@NotNull
@Column(length = 50)
var name: String,

@NotNull
@Enumerated(EnumType.STRING)
var category: Category,

@NotNull
var price: Int,

@NotNull
var description: String,

var likeNum: Int = 0

): BaseEntity()
Original file line number Diff line number Diff line change
Expand Up @@ -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
sojungpp marked this conversation as resolved.
Show resolved Hide resolved

): BaseEntity()
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
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_id")
var product: Product,

@ManyToOne
@JoinColumn(nullable = false, name = "user_id")
var user: User

): BaseEntity()
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
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_id")
var product: Product,

@ManyToOne
@JoinColumn(nullable = false, name = "user_id")
var user: User,

@NotNull
@Enumerated(EnumType.STRING)
var category: ReportCategory

): BaseEntity()
26 changes: 20 additions & 6 deletions src/main/kotlin/com/psr/psr/product/entity/review/Review.kt
Original file line number Diff line number Diff line change
@@ -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_id")
var product: Product,

@ManyToOne
@JoinColumn(nullable = false, name = "user_id")
var user: User,

@NotNull
var rating: Int,

var content: String

): BaseEntity()
Loading
Loading