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

feature/1 : 도메인 설정 및 기본 설정 추가 #2

Merged
merged 3 commits into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## #️⃣연관된 이슈

> ex) #이슈번호, #이슈번호

## 📝작업 내용

> 이번 PR에서 작업한 내용을 간략히 설명해주세요(이미지 첨부 가능)

### 스크린샷 (선택)
19 changes: 19 additions & 0 deletions src/main/kotlin/com/get_offer/bid/History.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.get_offer.bid

import com.get_offer.common.AuditingTimeEntity
import jakarta.persistence.Entity
import jakarta.persistence.GeneratedValue
import jakarta.persistence.GenerationType
import jakarta.persistence.Id

@Entity
class History(
private val productId: Long,
private val userId: Long,
private val biddingPrice: Int,
) : AuditingTimeEntity() {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private val id: Long? = null

}
18 changes: 18 additions & 0 deletions src/main/kotlin/com/get_offer/common/AuditingTimeEntity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.get_offer.common

import jakarta.persistence.EntityListeners
import jakarta.persistence.MappedSuperclass
import java.time.LocalDateTime
import org.springframework.data.annotation.CreatedDate
import org.springframework.data.annotation.LastModifiedDate
import org.springframework.data.jpa.domain.support.AuditingEntityListener

@EntityListeners(AuditingEntityListener::class)
@MappedSuperclass
abstract class AuditingTimeEntity {
@CreatedDate
private var createdAt: LocalDateTime = LocalDateTime.now()

@LastModifiedDate
private var updatedAt: LocalDateTime = LocalDateTime.now()
}
14 changes: 14 additions & 0 deletions src/main/kotlin/com/get_offer/product/Category.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.get_offer.product

enum class Category(
private val nameKr: String,
) {
ELECTRONICS("전자 제품"),
CLOTHES("의류"),
COSMETICS("화장품"),
SPORTS("스포츠용품"),
GAMES("게임"),
BOOKS("도서"),
FURNITURE("가구"),
ETC("기타")
}
38 changes: 38 additions & 0 deletions src/main/kotlin/com/get_offer/product/Product.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.get_offer.product

import com.get_offer.common.AuditingTimeEntity
import jakarta.persistence.Column
import jakarta.persistence.Entity
import jakarta.persistence.GeneratedValue
import jakarta.persistence.GenerationType
import jakarta.persistence.Id
import java.time.LocalDateTime

@Entity
class Product(
@Column(name = "user_id", nullable = false)
private val userId: Long,

private val name: String,

private val category: Category,

private val images: String,

private val description: String,

private val startPrice: Int,

private var currentPrice: Int,

private var status: ProductStatus,

private var startDate: LocalDateTime,

private var endDate: LocalDateTime
) : AuditingTimeEntity() {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private val id: Long? = null
}
8 changes: 8 additions & 0 deletions src/main/kotlin/com/get_offer/product/ProductStatus.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.get_offer.product

enum class ProductStatus {
WAIT,
IN_PROGRESS,
COMPLETED,
STOPPED,
}
21 changes: 21 additions & 0 deletions src/main/kotlin/com/get_offer/user/domain/User.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.get_offer.user.domain

import com.get_offer.common.AuditingTimeEntity
import jakarta.persistence.Entity
import jakarta.persistence.GeneratedValue
import jakarta.persistence.GenerationType
import jakarta.persistence.Id

@Entity(name = "users")
class User(
private val nickname: String,

private val userId: Long,

private val userImage: String? = null

) : AuditingTimeEntity() {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private val id: Long? = null
}
18 changes: 18 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
spring:
application:
name: get-offer
datasource:
driver-class-name: org.h2.Driver
url: 'jdbc:h2:mem:test'
username: username
password: password
h2:
console:
enabled: true
path: /h2-console
jpa:
database-platform: org.hibernate.dialect.H2Dialect
hibernate:
ddl-auto: create
properties:
hibernate:
dialect: org.hibernate.dialect.H2Dialect
format_sql: true
show_sql: true
Loading