-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: local db 설정 * feat: jpa entity 작성 * chore: jpa entity 네이밍 수정
- Loading branch information
Showing
21 changed files
with
254 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
adapters/out-persistence/src/main/kotlin/com/pokit/out/persistence/BaseEntity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.pokit.out.persistence | ||
|
||
import jakarta.persistence.Column | ||
import jakarta.persistence.EntityListeners | ||
import jakarta.persistence.MappedSuperclass | ||
import org.springframework.data.annotation.CreatedDate | ||
import org.springframework.data.annotation.LastModifiedDate | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener | ||
import java.time.LocalDateTime | ||
import java.time.ZoneId | ||
|
||
@MappedSuperclass | ||
@EntityListeners(value = [AuditingEntityListener::class]) | ||
abstract class BaseEntity { | ||
@CreatedDate | ||
@Column(updatable = false) | ||
var createdAt: LocalDateTime = LocalDateTime.now(ZoneId.of("Asia/Seoul")) | ||
|
||
@LastModifiedDate | ||
var updatedAt: LocalDateTime = LocalDateTime.now(ZoneId.of("Asia/Seoul")) | ||
} |
23 changes: 23 additions & 0 deletions
23
...persistence/src/main/kotlin/com/pokit/out/persistence/alert/persist/NotificationEntity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.pokit.out.persistence.alert.persist | ||
|
||
import jakarta.persistence.* | ||
import java.time.LocalDateTime | ||
|
||
@Table(name = "NOTIFICATION") | ||
@Entity | ||
class NotificationEntity( | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "id") | ||
val id: Long = 0L, | ||
|
||
@Column(name = "notification_time") | ||
val notificationTime: LocalDateTime, | ||
|
||
@Column(name = "content_id") | ||
val contentId: Long, | ||
|
||
@Column(name = "data") | ||
val data: String, | ||
) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...-persistence/src/main/kotlin/com/pokit/out/persistence/bookmark/persist/BookmarkEntity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.pokit.out.persistence.bookmark.persist | ||
|
||
import jakarta.persistence.* | ||
|
||
// 콕 엔티티 | ||
@Table(name = "BOOKMARK") | ||
@Entity | ||
class BookmarkEntity( | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "id") | ||
val id: Long = 0L, | ||
|
||
@Column(name = "content_id") | ||
val contentId: Long, | ||
|
||
@Column(name = "user_id") | ||
val userId: Long, | ||
) |
32 changes: 32 additions & 0 deletions
32
...-persistence/src/main/kotlin/com/pokit/out/persistence/category/persist/CategoryEntity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.pokit.out.persistence.category.persist | ||
|
||
import com.pokit.category.model.OpenType | ||
import com.pokit.out.persistence.BaseEntity | ||
import jakarta.persistence.* | ||
|
||
// 포킷 엔티티 | ||
@Table(name = "CATEGORY") | ||
@Entity | ||
class CategoryEntity( | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "id") | ||
val id: Long = 0L, | ||
|
||
@Column(name = "user_id") | ||
val userId: Long, | ||
|
||
@Column(name = "name") | ||
var name: String, | ||
|
||
@Column(name = "memo") | ||
var memo: String, | ||
|
||
@Enumerated(EnumType.STRING) | ||
@Column(name = "open_type") | ||
val openType: OpenType, | ||
|
||
@OneToOne | ||
@JoinColumn(name = "image_id") | ||
val image: CategoryImageEntity, | ||
) : BaseEntity() |
15 changes: 15 additions & 0 deletions
15
...istence/src/main/kotlin/com/pokit/out/persistence/category/persist/CategoryImageEntity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.pokit.out.persistence.category.persist | ||
|
||
import jakarta.persistence.* | ||
|
||
@Table(name = "CATEGORY_IMAGE") | ||
@Entity | ||
class CategoryImageEntity( | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "id") | ||
val id: Long = 0L, | ||
|
||
@Column(name = "path") | ||
val path: String, | ||
) |
33 changes: 33 additions & 0 deletions
33
...ut-persistence/src/main/kotlin/com/pokit/out/persistence/content/persist/ContentEntity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.pokit.out.persistence.content.persist | ||
|
||
import com.pokit.content.model.ContentType | ||
import com.pokit.out.persistence.BaseEntity | ||
import jakarta.persistence.* | ||
|
||
@Table(name = "CONTENT") | ||
@Entity | ||
class ContentEntity( | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "id") | ||
val id: Long = 0L, | ||
|
||
@Column(name = "category_id") | ||
val categoryId: Long, | ||
|
||
@Column(name = "type") | ||
@Enumerated(EnumType.STRING) | ||
val type: ContentType, | ||
|
||
@Column(name = "data") | ||
val data: String, // ex. LINK - url | ||
|
||
@Column(name = "title") | ||
val title: String, | ||
|
||
@Column(name = "memo") | ||
val memo: String, | ||
|
||
@Column(name = "alert_yn") | ||
val alertYn: String, | ||
) : BaseEntity() |
24 changes: 24 additions & 0 deletions
24
...rs/out-persistence/src/main/kotlin/com/pokit/out/persistence/log/persist/UserLogEntity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.pokit.out.persistence.log.persist | ||
|
||
import com.pokit.log.model.LogType | ||
import com.pokit.out.persistence.BaseEntity | ||
import jakarta.persistence.* | ||
|
||
@Table(name = "USER_LOG") | ||
@Entity | ||
class UserLogEntity( | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "id") | ||
val id: Long = 0L, | ||
|
||
@Column(name = "content_id") | ||
val contentId: Long, | ||
|
||
@Column(name = "user_id") | ||
val userId: Long, | ||
|
||
@Enumerated(EnumType.STRING) | ||
val type: LogType, | ||
) : BaseEntity() { | ||
} |
18 changes: 18 additions & 0 deletions
18
...ersistence/src/main/kotlin/com/pokit/out/persistence/subscribe/persist/SubscribeEntity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.pokit.out.persistence.subscribe.persist | ||
|
||
import jakarta.persistence.* | ||
|
||
@Table(name = "SUBSCRIBE") | ||
@Entity | ||
class SubscribeEntity( | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "id") | ||
val id: Long = 0L, | ||
|
||
@Column(name = "category_id") | ||
val categoryId: Long, | ||
|
||
@Column(name = "user_id") | ||
val userId: Long, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.pokit.category.model | ||
|
||
enum class OpenType { | ||
PUBLIC, | ||
PRIVATE, | ||
} |
6 changes: 6 additions & 0 deletions
6
domain/src/main/kotlin/com/pokit/content/model/ContentType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.pokit.content.model | ||
|
||
enum class ContentType { | ||
LINK, | ||
IMAGE, // 1.0 에는 사용안함 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.pokit.log.model | ||
|
||
enum class LogType { | ||
READ, // 읽음 로그 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.pokit.user.model | ||
|
||
enum class InterestType( | ||
val kor: String, | ||
) { | ||
SPORTS("스포츠/레저") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
version: "3.8" | ||
|
||
services: | ||
db: | ||
container_name: pokit-mysql-local | ||
image: mysql:8.0 | ||
ports: | ||
- "3306:3306" | ||
environment: | ||
MYSQL_ROOT_PASSWORD: pokit | ||
TZ: Asia/Seoul | ||
volumes: | ||
- ./init.sql:/docker-entrypoint-initdb.d/init.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
CREATE DATABASE IF NOT EXISTS pokit; | ||
USE pokit; |