File tree Expand file tree Collapse file tree 6 files changed +27
-5
lines changed
src/main/kotlin/org/gitanimals Expand file tree Collapse file tree 6 files changed +27
-5
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ data class GuildResponse(
6060 leader = Leader (
6161 userId = guild.getLeaderUserId().toString(),
6262 name = guild.getLeaderName(),
63- contributions = guild.getContributions ().toString(),
63+ contributions = guild.getLeaderContributions ().toString(),
6464 personaId = guild.getLeaderPersonaId().toString(),
6565 personaType = guild.getLeaderPersonaType(),
6666 ),
Original file line number Diff line number Diff line change @@ -140,7 +140,7 @@ class Guild(
140140
141141 fun getLeaderName (): String = leader.name
142142
143- fun getContributions (): Long = leader.contributions
143+ fun getLeaderContributions (): Long = leader.contributions
144144
145145 fun getGuildFarmType (): FieldType = farmType
146146
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ class UpdateGuildContributionSagaHandler(
2020
2121 guildService.updateContribution(
2222 username = userContributionUpdated.username,
23- contributions = userContributionUpdated.contributions.toLong() ,
23+ contributions = userContributionUpdated.contributions,
2424 )
2525 }
2626}
Original file line number Diff line number Diff line change 11package org.gitanimals.guild.saga.event
22
3+ import java.time.Instant
4+
35data class UserContributionUpdated (
46 val username : String ,
5- val point : Long ,
6- val contributions : Int ,
7+ val contributions : Long ,
8+ val userContributionUpdated : Boolean ,
9+ val contributionUpdatedAt : Instant ,
710)
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore
44import jakarta.persistence.*
55import org.gitanimals.core.*
66import org.gitanimals.render.domain.event.PersonaDeleted
7+ import org.gitanimals.render.domain.event.UserContributionUpdated
78import org.gitanimals.render.domain.extension.RenderFieldTypeExtension.isRenderField
89import org.gitanimals.render.domain.listeners.DomainEventPublisher
910import org.gitanimals.render.domain.response.PersonaResponse
@@ -144,6 +145,13 @@ class User(
144145 currentYearContribution.lastUpdatedContribution = Instant .now()
145146 levelUpPersonas(newContribution)
146147
148+ DomainEventPublisher .publish(
149+ UserContributionUpdated (
150+ username = this .name,
151+ contributions = contributions.totalCount(),
152+ )
153+ )
154+
147155 return newContribution
148156 }
149157
Original file line number Diff line number Diff line change 1+ package org.gitanimals.render.domain.event
2+
3+ import org.gitanimals.core.instant
4+ import java.time.Instant
5+
6+ data class UserContributionUpdated (
7+ val username : String ,
8+ val contributions : Long ,
9+ val userContributionUpdated : Boolean = true ,
10+ val contributionUpdatedAt : Instant = instant(),
11+ )
You can’t perform that action at this time.
0 commit comments