very basic frontend skeleton
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
import score_update
|
||||
|
||||
pub type UpdateScore {
|
||||
BuzzIn(user_id: Int, score_update: score_update.ScoreUpdateType)
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
pub type ScoreUpdateType {
|
||||
Add
|
||||
Subtract
|
||||
Reset
|
||||
}
|
||||
|
||||
pub type Error {
|
||||
InvalidUpdateType
|
||||
}
|
||||
|
||||
pub fn serialize(score_update: ScoreUpdateType) -> String {
|
||||
case score_update {
|
||||
Add -> "Add"
|
||||
Subtract -> "Subtract"
|
||||
Reset -> "Reset"
|
||||
}
|
||||
}
|
||||
|
||||
pub fn deseralize(score_update_string) -> Result(ScoreUpdateType, Error) {
|
||||
case score_update_string {
|
||||
"Add" -> Ok(Add)
|
||||
"Subtract" -> Ok(Subtract)
|
||||
"Reset" -> Ok(Reset)
|
||||
_ -> Error(InvalidUpdateType)
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1 @@
|
||||
import gleam/io
|
||||
|
||||
pub fn main() {
|
||||
io.println("Hello from shared!")
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
import gleam/option
|
||||
|
||||
pub type UserState {
|
||||
UserState(id: Int, name: String, game_id: option.Option(Int))
|
||||
}
|
||||
Reference in New Issue
Block a user