various cleanups

This commit is contained in:
nek0 2022-02-20 21:03:05 +01:00
parent fb679ff96b
commit af6cd61ea1
2 changed files with 13 additions and 14 deletions

View file

@ -5,8 +5,6 @@ module Types.Role where
import qualified Data.Text as T import qualified Data.Text as T
import Data.Aeson import Data.Aeson
import Data.Time (UTCTime)
import GHC.Generics import GHC.Generics
-- internal imports -- internal imports
@ -17,10 +15,11 @@ import Classes.FromDatabase
data Role = Role data Role = Role
{ roleID :: Int { roleID :: Int
, roleName :: T.Text , roleName :: T.Text
-- | Can add new items into the stock of already existing products
, roleCanRefillStock :: Bool , roleCanRefillStock :: Bool
-- | paying invoice only adds to user funds -- | Paying invoice only adds to user funds
, roleCanPayInvoice :: Bool , roleCanPayInvoice :: Bool
-- | paying out actually removes money from the cashier -- | Paying out actually removes money from the cashier
, roleCanPayOut :: Bool , roleCanPayOut :: Bool
, roleCanManageProducts :: Bool , roleCanManageProducts :: Bool
, roleCanManageJournal :: Bool , roleCanManageJournal :: Bool

View file

@ -31,19 +31,19 @@ import Model
import Types import Types
printSql :: Default Unpackspec a a => Select a -> IO () printSql :: Default Unpackspec a a => Select a -> IO ()
printSql = putStrLn . fromMaybe "Empty query" . showSqlForPostgres printSql = putStrLn . fromMaybe "Empty query" . showSql
initDB :: Connection -> IO () initDB :: Connection -> IO ()
initDB conn = do initDB conn = do
execute_ conn initAvatar void $ execute_ conn initAvatar
execute_ conn initUser void $ execute_ conn initUser
execute_ conn initProduct void $ execute_ conn initProduct
execute_ conn initToken void $ execute_ conn initToken
execute_ conn initAuthData void $ execute_ conn initAuthData
execute_ conn initAmount void $ execute_ conn initAmount
execute_ conn initJournal void $ execute_ conn initJournal
execute_ conn initRole void $ execute_ conn initRole
execute_ conn initUserToRole void $ execute_ conn initUserToRole
void $ runInsertInitialRoles conn void $ runInsertInitialRoles conn
-- This is only a dummy function. -- This is only a dummy function.