halogen-websocket-ipc-playzone/src/App/UserPublic.purs

20 lines
701 B
Plaintext
Raw Normal View History

2023-05-26 01:39:50 +02:00
module App.UserPublic where
import Prelude
import Data.Codec.Argonaut (JsonCodec)
import Data.Codec.Argonaut as CA
import Data.Codec.Argonaut.Record as CAR
import Data.Newtype (class Newtype)
-- | Currently not the real type.
-- | Lacks 'profile' and 'date_registration' attributes.
-- type UserPublic row = { login :: String, uid :: Int | row }
-- TODO: add profile :: JSON any, date_registration :: Maybe Time
type UserPublic = { login :: String, uid :: Int }
2023-05-26 01:39:50 +02:00
-- | UserPublic.codec can be used to parse and encode public user info,
-- | which can be exchanged in different messages.
codec :: JsonCodec UserPublic
codec = CA.object "UserPublic" (CAR.record { "login": CA.string, "uid": CA.int })