-
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.
Merge branch 'feature/DRAW-406' into sandbox
- Loading branch information
Showing
16 changed files
with
378 additions
and
59 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
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
50 changes: 50 additions & 0 deletions
50
adapter/redis/src/main/kotlin/com/xorker/draw/mafia/entity/MafiaGameOptionRedisEntity.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,50 @@ | ||
package com.xorker.draw.mafia.entity | ||
|
||
import com.xorker.draw.mafia.MafiaGameOption | ||
import com.xorker.draw.room.RoomId | ||
import java.time.Duration | ||
import org.springframework.data.annotation.Id | ||
|
||
internal data class MafiaGameOptionRedisEntity( | ||
@Id val id: String, | ||
val minimum: Int, | ||
val maximum: Int, | ||
val readyTime: Long, | ||
val introAnimationTime: Long, | ||
val roundAnimationTime: Long, | ||
val round: Int, | ||
val turnTime: Long, | ||
val turnCount: Int, | ||
val voteTime: Long, | ||
val answerTime: Long, | ||
val endTime: Long, | ||
) | ||
|
||
internal fun MafiaGameOption.toEntity(roomId: RoomId): MafiaGameOptionRedisEntity = MafiaGameOptionRedisEntity( | ||
id = roomId.value, | ||
minimum = this.minimum, | ||
maximum = this.maximum, | ||
readyTime = this.readyTime.toMillis(), | ||
introAnimationTime = this.introAnimationTime.toMillis(), | ||
roundAnimationTime = this.roundAnimationTime.toMillis(), | ||
round = this.round, | ||
turnTime = this.turnTime.toMillis(), | ||
turnCount = this.turnCount, | ||
voteTime = this.voteTime.toMillis(), | ||
answerTime = this.answerTime.toMillis(), | ||
endTime = this.endTime.toMillis(), | ||
) | ||
|
||
internal fun MafiaGameOptionRedisEntity.toDomain(): MafiaGameOption = MafiaGameOption( | ||
minimum = this.minimum, | ||
maximum = this.maximum, | ||
readyTime = Duration.ofMillis(this.readyTime), | ||
introAnimationTime = Duration.ofMillis(this.introAnimationTime), | ||
roundAnimationTime = Duration.ofMillis(this.roundAnimationTime), | ||
round = this.round, | ||
turnTime = Duration.ofMillis(this.turnTime), | ||
turnCount = this.turnCount, | ||
voteTime = Duration.ofMillis(this.voteTime), | ||
answerTime = Duration.ofMillis(this.answerTime), | ||
endTime = Duration.ofMillis(this.endTime), | ||
) |
5 changes: 5 additions & 0 deletions
5
adapter/redis/src/main/kotlin/com/xorker/draw/mafia/entity/MafiaGameOptionRedisRepository.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,5 @@ | ||
package com.xorker.draw.mafia.entity | ||
|
||
import org.springframework.data.repository.CrudRepository | ||
|
||
internal interface MafiaGameOptionRedisRepository : CrudRepository<MafiaGameOptionRedisEntity, String> |
Oops, something went wrong.