-
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.
feat : 배치 알림, 배치-컨텐츠 매칭, fcm토큰 엔티티 (#112)
- Loading branch information
1 parent
490ec4d
commit 8dd9888
Showing
6 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
...t-persistence/src/main/kotlin/com/pokit/out/persistence/alert/persist/AlertBatchEntity.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,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, | ||
) | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...persistence/src/main/kotlin/com/pokit/out/persistence/alert/persist/AlertContentEntity.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,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 | ||
) | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
.../out-persistence/src/main/kotlin/com/pokit/out/persistence/user/persist/FcmTokenEntity.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,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 | ||
) | ||
} | ||
} |
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,8 @@ | ||
package com.pokit.alert.model | ||
|
||
import java.time.LocalDate | ||
|
||
data class AlertBatch( | ||
val userId: Long, | ||
val shouldBeSentAt: LocalDate, | ||
) |
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.alert.model | ||
|
||
data class AlertContent( | ||
val alertBatchId: Long, | ||
val contentId: 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
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 | ||
) |