22 lines
706 B
Haskell
22 lines
706 B
Haskell
|
|
module Web.Controller.EnvelopeEmissionContracts where
|
||
|
|
|
||
|
|
import Web.Types
|
||
|
|
import Web.View.EnvelopeEmissionContracts.Index
|
||
|
|
import Web.View.EnvelopeEmissionContracts.Show
|
||
|
|
import Generated.Types
|
||
|
|
import IHP.Prelude
|
||
|
|
import IHP.ControllerPrelude
|
||
|
|
|
||
|
|
instance Controller EnvelopeEmissionContractsController where
|
||
|
|
beforeAction = ensureIsUser
|
||
|
|
|
||
|
|
action EnvelopeEmissionContractsAction = do
|
||
|
|
contracts <- query @EnvelopeEmissionContract
|
||
|
|
|> orderByDesc #createdAt
|
||
|
|
|> fetch
|
||
|
|
render IndexView { contracts }
|
||
|
|
|
||
|
|
action ShowEnvelopeEmissionContractAction { envelopeEmissionContractId } = do
|
||
|
|
contract <- fetch envelopeEmissionContractId
|
||
|
|
render ShowView { contract }
|