dummy Auth and authed routes
This commit is contained in:
@@ -3,70 +3,75 @@ package industries.sunshine.planningpoker.common
|
||||
import java.util.UUID
|
||||
|
||||
object Models {
|
||||
/** view of the single planning poker round
|
||||
* @param players
|
||||
* \- people who are currently playing
|
||||
* @param allowedCards
|
||||
* \- the cards values that can be used by players
|
||||
* @param round
|
||||
* \- state of the selected cards of the players
|
||||
* @param canCloseRound
|
||||
* \- whether current player has access to button to finish the round
|
||||
*/
|
||||
final case class RoomStateView(
|
||||
players: List[Player],
|
||||
me: PlayerID,
|
||||
allowedCards: List[String],
|
||||
round: RoundState,
|
||||
canCloseRound: Boolean = false
|
||||
) {
|
||||
def playersCount: Int = players.size
|
||||
}
|
||||
|
||||
object RoomStateView {
|
||||
val me = Player("wormy", PlayerID())
|
||||
val testRoom = {
|
||||
val pony = Player("pony", PlayerID())
|
||||
RoomStateView(
|
||||
players = List(me, Player("birdy", PlayerID()), pony),
|
||||
me = me.id,
|
||||
allowedCards = List("xs", "s", "m", "l", "xl"),
|
||||
round = VotingRound(myCard = Some("s"), alreadyVoted = List(me, pony)),
|
||||
canCloseRound = true
|
||||
)
|
||||
}
|
||||
val testOpenedRoom = {
|
||||
val pony = Player("pony", PlayerID())
|
||||
val birdy = Player("birdy", PlayerID())
|
||||
val horsey = Player("horsey", PlayerID())
|
||||
RoomStateView(
|
||||
players = List(me, birdy, pony, horsey),
|
||||
me = me.id,
|
||||
allowedCards = List("xs", "s", "m", "l", "xl"),
|
||||
round = ViewingRound(Map( me.id -> "xs", pony.id -> "l", birdy.id -> "s", horsey.id -> "m" )),
|
||||
canCloseRound = true
|
||||
)
|
||||
/** view of the single planning poker round
|
||||
* @param players
|
||||
* \- people who are currently playing
|
||||
* @param allowedCards
|
||||
* \- the cards values that can be used by players
|
||||
* @param round
|
||||
* \- state of the selected cards of the players
|
||||
* @param canCloseRound
|
||||
* \- whether current player has access to button to finish the round
|
||||
*/
|
||||
final case class RoomStateView(
|
||||
players: List[Player],
|
||||
me: PlayerID,
|
||||
allowedCards: List[String],
|
||||
round: RoundState,
|
||||
canCloseRound: Boolean = false
|
||||
) {
|
||||
def playersCount: Int = players.size
|
||||
}
|
||||
|
||||
}
|
||||
object RoomStateView {
|
||||
val me = Player("wormy", PlayerID(1))
|
||||
val testRoom = {
|
||||
val pony = Player("pony", PlayerID(2))
|
||||
RoomStateView(
|
||||
players = List(me, Player("birdy", PlayerID(3)), pony),
|
||||
me = me.id,
|
||||
allowedCards = List("xs", "s", "m", "l", "xl"),
|
||||
round = VotingRound(myCard = Some("s"), alreadyVoted = List(me, pony)),
|
||||
canCloseRound = true
|
||||
)
|
||||
}
|
||||
val testOpenedRoom = {
|
||||
val pony = Player("pony", PlayerID(10))
|
||||
val birdy = Player("birdy", PlayerID(11))
|
||||
val horsey = Player("horsey", PlayerID(12))
|
||||
RoomStateView(
|
||||
players = List(me, birdy, pony, horsey),
|
||||
me = me.id,
|
||||
allowedCards = List("xs", "s", "m", "l", "xl"),
|
||||
round = ViewingRound(
|
||||
Map(me.id -> "xs", pony.id -> "l", birdy.id -> "s", horsey.id -> "m")
|
||||
),
|
||||
canCloseRound = true
|
||||
)
|
||||
}
|
||||
|
||||
trait RoundState
|
||||
}
|
||||
|
||||
/** view state for round before votes are open player can know their vote and
|
||||
* who of the other players have voted
|
||||
*/
|
||||
final case class VotingRound(
|
||||
myCard: Option[String],
|
||||
alreadyVoted: List[Player]
|
||||
) extends RoundState
|
||||
trait RoundState
|
||||
|
||||
/** view state for round after opening the votes
|
||||
*/
|
||||
final case class ViewingRound(
|
||||
votes: Map[PlayerID, String]
|
||||
) extends RoundState
|
||||
/** view state for round before votes are open player can know their vote and
|
||||
* who of the other players have voted
|
||||
*/
|
||||
final case class VotingRound(
|
||||
myCard: Option[String],
|
||||
alreadyVoted: List[Player]
|
||||
) extends RoundState
|
||||
|
||||
final class PlayerID
|
||||
final case class Player(name: String, id: PlayerID)
|
||||
/** view state for round after opening the votes
|
||||
*/
|
||||
final case class ViewingRound(
|
||||
votes: Map[PlayerID, String]
|
||||
) extends RoundState
|
||||
|
||||
final case class PlayerID(id: Long)
|
||||
final case class Player(name: String, id: PlayerID)
|
||||
|
||||
final case class RoomID(id: Long)
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user