Advertisement
Guest User

Untitled

a guest
May 31st, 2017
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. data Person = Person {
  2.     personId :: UUID,
  3.     firstName :: String,
  4.     lastName  :: String,
  5.     phoneNumber :: String,
  6.     mobileNumber :: String,
  7.     mobileNumber2 :: String,
  8.     birthDate :: Day,
  9. --     image :: ByteString,
  10.     nationalCode :: String,
  11.     postalCode :: String,
  12.     address :: String
  13.     } deriving (Show, Generic)
  14.  
  15.  
  16. data Account  = Account {
  17.     accountId :: UUID,
  18.     cityId :: Maybe Int,
  19.     userTypeId :: Maybe Int,
  20.     userName :: String,
  21.     password :: String,
  22.     email :: Maybe String,
  23.     pushToken :: Maybe String,
  24.     active :: Maybe Bool,
  25.     registerDate :: Maybe Day,
  26.     verificationCode :: Maybe String,
  27.     verified :: Bool,
  28.     referrerId :: UUID,
  29.     person :: DefaultKey Person
  30.     } deriving Generic
  31.  
  32. deriving instance Show Account
  33.  
  34.  
  35. data Vehicle = Vehicle {
  36.     vehicleId :: UUID,
  37.     vehicleCapacity :: Int,
  38.     vehicleModel :: String,
  39.     plateNumber :: String,
  40.     imei :: String,
  41.     rate :: Double,
  42.     imei2 :: String,
  43.     workHours :: String,
  44. --     bankAccountInfo :: Object,
  45.     appVersion :: Int,
  46.     account :: DefaultKey Account
  47.  
  48. }
  49.  
  50. addVehicle :: Pool Postgresql -> Vehicle -> IO (AutoKey Vehicle)
  51.  
  52. addVehicle pool v = do
  53.     pid <- nextRandom
  54.     aid <- nextRandom
  55.  
  56.     let v = v {account = (account v) {accountId = aid} }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement