Skip to content

Commit

Permalink
feat : 배치 알림, 배치-컨텐츠 매칭, fcm토큰 엔티티 (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
dlswns2480 authored Aug 23, 2024
1 parent 490ec4d commit 8dd9888
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.pokit.out.persistence.alert.persist

import com.pokit.alert.model.AlertBatch
import com.pokit.out.persistence.BaseEntity
import jakarta.persistence.*
import java.time.LocalDate

@Table(name = "ALERT_BATCH")
@Entity
class AlertBatchEntity(
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
val id: Long = 0L,

@Column(name = "user_id")
val userId: Long,

@Column(name = "should_be_send_at")
val shouldBeSentAt: LocalDate,

@Column(name = "is_sent")
var sent: Boolean = false
) : BaseEntity() {
fun sent() {
this.sent = true
}

companion object {
fun of(alertBatch: AlertBatch) = AlertBatchEntity(
userId = alertBatch.userId,
shouldBeSentAt = alertBatch.shouldBeSentAt,
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.pokit.out.persistence.alert.persist

import com.pokit.alert.model.AlertContent
import com.pokit.out.persistence.BaseEntity
import jakarta.persistence.*

@Table(name = "alert_content")
@Entity
class AlertContentEntity(
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
val id: Long = 0L,

@Column(name = "alert_batch_id")
val alertBatchId: Long,

@Column(name = "content_id")
val contentId: Long,

@Column(name = "is_deleted")
var delete: Boolean = false
) : BaseEntity() {
fun delete() {
this.delete = true
}

companion object {
fun of(alertContent: AlertContent) = AlertContentEntity(
alertBatchId = alertContent.alertBatchId,
contentId = alertContent.contentId
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.pokit.out.persistence.user.persist

import com.pokit.user.model.FcmToken
import jakarta.persistence.*

@Table(name = "FCM_TOKEN")
@Entity
class FcmTokenEntity(
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
val id: Long = 0L,

@Column(name = "user_id")
val userId: Long,

@Column(name = "token")
val token: String
) {
companion object {
fun of(fcmToken: FcmToken) = FcmTokenEntity(
userId = fcmToken.userId,
token = fcmToken.token
)
}
}
8 changes: 8 additions & 0 deletions domain/src/main/kotlin/com/pokit/alert/model/AlertBatch.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.pokit.alert.model

import java.time.LocalDate

data class AlertBatch(
val userId: Long,
val shouldBeSentAt: LocalDate,
)
6 changes: 6 additions & 0 deletions domain/src/main/kotlin/com/pokit/alert/model/AlertContent.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.pokit.alert.model

data class AlertContent(
val alertBatchId: Long,
val contentId: Long
)
6 changes: 6 additions & 0 deletions domain/src/main/kotlin/com/pokit/user/model/FcmToken.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.pokit.user.model

data class FcmToken(
val userId: Long,
val token: String
)

0 comments on commit 8dd9888

Please sign in to comment.