Skip to content

Commit aab6043

Browse files
authored
release: 1.7.9 (#194)
2 parents 791b1ad + 28f15cc commit aab6043

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

src/main/kotlin/org/gitanimals/quiz/app/DenyQuizFacade.kt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package org.gitanimals.quiz.app
22

33
import org.gitanimals.core.IdGenerator
4+
import org.gitanimals.core.clock
5+
import org.gitanimals.inbox.domain.InboxType
46
import org.gitanimals.quiz.app.CreateQuizFacade.Companion.CREATE_QUIZ_PRICE
57
import org.gitanimals.quiz.domain.not_approved.NotApprovedQuizService
68
import org.slf4j.LoggerFactory
@@ -9,6 +11,7 @@ import org.springframework.stereotype.Service
911

1012
@Service
1113
class DenyQuizFacade(
14+
private val inboxApi: InboxApi,
1215
private val identityApi: IdentityApi,
1316
private val notApprovedQuizService: NotApprovedQuizService,
1417
@Value("\${quiz.approve.token}") private val approveToken: String,
@@ -35,6 +38,23 @@ class DenyQuizFacade(
3538
point = CREATE_QUIZ_PRICE,
3639
idempotencyKey = IdGenerator.generate().toString(),
3740
)
41+
42+
inboxApi.inputInbox(
43+
InboxApi.InboxInputRequest(
44+
publisher = InboxApi.InboxInputRequest.Publisher(
45+
publisher = "QUIZ",
46+
publishedAt = clock.instant(),
47+
),
48+
inboxData = InboxApi.InboxInputRequest.InboxData(
49+
userId = notApprovedQuiz.userId,
50+
type = InboxType.INBOX,
51+
title = "Revoked Quiz create point.",
52+
body = "Since your quiz was judged to be a duplicate, 5,000 points have been rolled back.",
53+
image = "https://avatars.githubusercontent.com/u/171903401?s=200&v=4",
54+
redirectTo = "NO_REDIRECT",
55+
)
56+
)
57+
)
3858
}.getOrElse {
3959
logger.error("[DenyQuizFacade] Cannot decrease point. userId: \"${notApprovedQuiz.userId}\", point: \"$CREATE_QUIZ_PRICE\"")
4060
}

src/main/kotlin/org/gitanimals/quiz/app/InboxApi.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ fun interface InboxApi {
1111

1212
data class InboxInputRequest(
1313
val inboxData: InboxData,
14+
val publisher: Publisher,
1415
) {
1516

1617
data class Publisher(

src/main/kotlin/org/gitanimals/quiz/infra/hibernate/QuizSolveContextDoneHibernateEventListener.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package org.gitanimals.quiz.infra.hibernate
22

33
import org.gitanimals.core.GracefulShutdownDispatcher.gracefulLaunch
44
import org.gitanimals.core.IdGenerator
5+
import org.gitanimals.core.clock
56
import org.gitanimals.inbox.domain.InboxType
67
import org.gitanimals.quiz.app.IdentityApi
78
import org.gitanimals.quiz.app.InboxApi
@@ -66,6 +67,10 @@ class QuizSolveContextDoneLogicDelegator(
6667
}.onSuccess {
6768
inboxApi.inputInbox(
6869
InboxInputRequest(
70+
publisher = InboxInputRequest.Publisher(
71+
publisher = "QUIZ",
72+
publishedAt = clock.instant(),
73+
),
6974
inboxData = InboxData(
7075
userId = event.userId,
7176
type = InboxType.INBOX,

0 commit comments

Comments
 (0)