blob: c289fe0a3c80e29fde4b8c27bab71891907b99b1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
{-# LANGUAGE DeriveGeneric #-}
module Model.Json.User
( User(..)
, fromUser
) where
import Data.Aeson
import Data.Text (Text)
import GHC.Generics
import Model.User (UserId)
import qualified Model.User as M
data User = User
{ id :: UserId
, name :: Text
, email :: Text
} deriving (Show, Generic)
instance FromJSON User
instance ToJSON User
fromUser :: M.User -> User
fromUser user = User (M.id user) (M.name user) (M.email user)
|