Change the name User to Account

Next I'll need to add / remove fields from the Account type.
This commit is contained in:
William Carroll 2020-07-25 18:18:59 +01:00
parent 718152ec14
commit d011616564
3 changed files with 12 additions and 12 deletions

View file

@ -16,20 +16,20 @@ import Database.Persist.TH
--------------------------------------------------------------------------------
share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persistLowerCase|
User
Account
name Text
age Int
UniqueName name
deriving Eq Read Show
|]
instance FromJSON User where
instance FromJSON Account where
parseJSON = withObject "User" $ \ v ->
User <$> v .: "name"
<*> v .: "age"
Account <$> v .: "name"
<*> v .: "age"
instance ToJSON User where
toJSON (User name age) =
instance ToJSON Account where
toJSON (Account name age) =
object [ "name" .= name
, "age" .= age
]