Update type of ShipRegistration name to ShipSymbol
Some checks are pending
test / test (push) Waiting to run
Some checks are pending
test / test (push) Waiting to run
This commit is contained in:
parent
050cef92e4
commit
e9f12e8a26
1 changed files with 7 additions and 2 deletions
|
@ -1,13 +1,18 @@
|
|||
import gleam/dynamic/decode.{type Decoder}
|
||||
import spacetraders_models/faction_symbol.{type FactionSymbol}
|
||||
import spacetraders_models/ship_role.{type ShipRole}
|
||||
import spacetraders_models/ship_symbol.{type ShipSymbol}
|
||||
|
||||
pub type ShipRegistration {
|
||||
ShipRegistration(name: String, faction_symbol: FactionSymbol, role: ShipRole)
|
||||
ShipRegistration(
|
||||
name: ShipSymbol,
|
||||
faction_symbol: FactionSymbol,
|
||||
role: ShipRole,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn decoder() -> Decoder(ShipRegistration) {
|
||||
use name <- decode.field("name", decode.string)
|
||||
use name <- decode.field("name", ship_symbol.decoder())
|
||||
use faction_symbol <- decode.field("factionSymbol", faction_symbol.decoder())
|
||||
use role <- decode.field("role", ship_role.decoder())
|
||||
decode.success(ShipRegistration(name:, faction_symbol:, role:))
|
||||
|
|
Loading…
Reference in a new issue