packages feed

happs-tutorial-0.4: src/SerializeableUsers.hs

{-# LANGUAGE TemplateHaskell, DeriveDataTypeable, NoMonomorphismRestriction  #-}
module SerializeableUsers where
import HAppS.State
import Data.Generics
import qualified Data.Set as S
data Job = Job {jobname :: String
                , jobbudget :: String -- we allow jobs with unspecified budgets
                , jobblurb :: String}
  deriving (Show,Read,Ord, Eq, Typeable,Data)
instance Version Job
$(deriveSerialize ''Job) 


-- Better name would be just "Profile." Users who aren't consultants, eg want consultants for a project,
-- also use profiles. But I'm in a hurry so leaving as is for now and not changing the names everywhere.
data ConsultantProfile = ConsultantProfile {
  --billing_rate :: String -- eg "" (blank is ok), "$30-$50/hour", "40-50 Euro/hour", "it depends on the project", etc.
  contact :: String -- eg, "thomashartman1 at gmail, 917 915 9941"
  -- tell something about yourself. Edited via a text area. should replace newlines with <br> when displayed.
  , blurb :: String 
  , consultant :: Bool -- this is what actually determines whether the profile will list as a consultant or not
} deriving (Show,Read,Ord, Eq, Typeable,Data)
instance Version ConsultantProfile
$(deriveSerialize ''ConsultantProfile) 

-- Users should also have Maybe a consultant profile, Maybe [list of jobs they want done]
data User = User {                                                                          
  username :: String                                                                      
  , password :: String
  , consultantprofile :: ConsultantProfile
  , jobs :: [Job]
} deriving (Show,Read,Ord, Eq, Typeable,Data)
instance Version User
$(deriveSerialize ''User)