mateamt/src/Types/Role.hs

74 lines
1.9 KiB
Haskell
Raw Normal View History

2020-07-19 10:27:28 +00:00
{-# LANGUAGE DeriveGeneric #-}
2020-05-10 06:35:32 +00:00
module Types.Role where
import qualified Data.Text as T
2020-07-19 10:27:28 +00:00
import Data.Aeson
import GHC.Generics
2020-05-10 06:35:32 +00:00
data Role = Role
{ roleID :: Int
, roleName :: T.Text
, roleCanRefillStock :: Bool
, roleCanAddProduct :: Bool
, roleCanViewJournal :: Bool
, roleCanPayInvoice :: Bool
, roleCanPayOut :: Bool
, roleCanManageProducts :: Bool
, roleCanManageJournal :: Bool
, roleCanManageUsers :: Bool
, roleCanManageRoles :: Bool
, roleCanManageSuppliers :: Bool
, roleCanManageSettings :: Bool
}
2020-07-19 10:27:28 +00:00
deriving (Generic, Show)
instance ToJSON Role where
toEncoding = genericToEncoding defaultOptions
instance FromJSON Role
2020-07-19 06:27:15 +00:00
data RoleSubmit = RoleSubmit
{ roleSubmitName :: T.Text
, roleSubmitCanRefillStock :: Bool
, roleSubmitCanAddProduct :: Bool
, roleSubmitCanViewJournal :: Bool
, roleSubmitCanPayInvoice :: Bool
, roleSubmitCanPayOut :: Bool
, roleSubmitCanManageProducts :: Bool
, roleSubmitCanManageJournal :: Bool
, roleSubmitCanManageUsers :: Bool
, roleSubmitCanManageRoles :: Bool
, roleSubmitCanManageSuppliers :: Bool
, roleSubmitCanManageSettings :: Bool
}
2020-07-19 10:27:28 +00:00
deriving (Generic, Show)
instance ToJSON RoleSubmit where
toEncoding = genericToEncoding defaultOptions
instance FromJSON RoleSubmit
2020-07-19 06:27:15 +00:00
data RoleAssociation = RoleAssociation
{ roleAssociationId :: Int
, roleAssociationUser :: Int
, roleAssociationRole :: Int
}
2020-07-19 10:27:28 +00:00
deriving (Generic, Show)
instance ToJSON RoleAssociation where
toEncoding = genericToEncoding defaultOptions
instance FromJSON RoleAssociation
2020-07-19 06:27:15 +00:00
data RoleAssociationSubmit = RoleAssociationSubmit
{ roleAssociationSubmitUser :: Int
, roleAssociationSubmitRole :: Int
}
2020-07-19 10:27:28 +00:00
deriving (Generic, Show)
instance ToJSON RoleAssociationSubmit where
toEncoding = genericToEncoding defaultOptions
instance FromJSON RoleAssociationSubmit