22 lines
742 B
Haskell
22 lines
742 B
Haskell
|
|
module Web.Controller.InteractionReportingContracts where
|
||
|
|
|
||
|
|
import Web.Types
|
||
|
|
import Web.View.InteractionReportingContracts.Index
|
||
|
|
import Web.View.InteractionReportingContracts.Show
|
||
|
|
import Generated.Types
|
||
|
|
import IHP.Prelude
|
||
|
|
import IHP.ControllerPrelude
|
||
|
|
|
||
|
|
instance Controller InteractionReportingContractsController where
|
||
|
|
beforeAction = ensureIsUser
|
||
|
|
|
||
|
|
action InteractionReportingContractsAction = do
|
||
|
|
contracts <- query @InteractionReportingContract
|
||
|
|
|> orderByDesc #createdAt
|
||
|
|
|> fetch
|
||
|
|
render IndexView { contracts }
|
||
|
|
|
||
|
|
action ShowInteractionReportingContractAction { interactionReportingContractId } = do
|
||
|
|
contract <- fetch interactionReportingContractId
|
||
|
|
render ShowView { contract }
|