generated from coulomb/repo-seed
feat: minimal IHP scaffold — T01-T05, T08 of IRP-WP-0001
- flake.nix adapted from inter-hub: appName=ihp-railiance-probe, stripped to core packages, GHC 9.10.3 Bug 1+2 overlays carried verbatim (pname check updated to ihp-railiance-probe-models) - IHP project scaffold: Main.hs, Config.hs, App.cabal, Setup.hs, Makefile - Schema: probes table (id, name, created_at) - Health endpoint: GET /healthz → "ok" (HealthController) - Probes CRUD: ProbesController + 4 views (Index, New, Show, Edit) - Hspec test suite: Test/ProbeControllerSpec covers /probes and /healthz - Helm chart in chart/: deployment, service, ingress, secret templates - devenv.nix, devenv.yaml, .ghci, tailwind config Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
7
Web/Controller/Health.hs
Normal file
7
Web/Controller/Health.hs
Normal file
@@ -0,0 +1,7 @@
|
||||
module Web.Controller.Health where
|
||||
|
||||
import Web.Controller.Prelude
|
||||
import Web.Types
|
||||
|
||||
instance Controller HealthController where
|
||||
action HealthAction = renderPlain "ok"
|
||||
12
Web/Controller/Prelude.hs
Normal file
12
Web/Controller/Prelude.hs
Normal file
@@ -0,0 +1,12 @@
|
||||
module Web.Controller.Prelude
|
||||
( module Web.Types
|
||||
, module Generated.Types
|
||||
, module IHP.Prelude
|
||||
, module IHP.ControllerPrelude
|
||||
) where
|
||||
|
||||
import Web.Types
|
||||
import Generated.Types
|
||||
import IHP.Prelude
|
||||
import IHP.ControllerPrelude
|
||||
import Web.Routes ()
|
||||
42
Web/Controller/Probes.hs
Normal file
42
Web/Controller/Probes.hs
Normal file
@@ -0,0 +1,42 @@
|
||||
module Web.Controller.Probes where
|
||||
|
||||
import Web.Controller.Prelude
|
||||
import Web.View.Probes.Index
|
||||
import Web.View.Probes.New
|
||||
import Web.View.Probes.Show
|
||||
import Web.View.Probes.Edit
|
||||
|
||||
instance Controller ProbesController where
|
||||
action ProbesAction = do
|
||||
probes <- query @Probe |> fetch
|
||||
render IndexView { .. }
|
||||
|
||||
action NewProbeAction = do
|
||||
let probe = newRecord @Probe
|
||||
render NewView { .. }
|
||||
|
||||
action ShowProbeAction { probeId } = do
|
||||
probe <- fetch probeId
|
||||
render ShowView { .. }
|
||||
|
||||
action CreateProbeAction = do
|
||||
newRecord @Probe
|
||||
|> fill @'["name"]
|
||||
|> createRecord
|
||||
redirectTo ProbesAction
|
||||
|
||||
action EditProbeAction { probeId } = do
|
||||
probe <- fetch probeId
|
||||
render EditView { .. }
|
||||
|
||||
action UpdateProbeAction { probeId } = do
|
||||
probe <- fetch probeId
|
||||
probe
|
||||
|> fill @'["name"]
|
||||
|> updateRecord
|
||||
redirectTo ProbesAction
|
||||
|
||||
action DeleteProbeAction { probeId } = do
|
||||
probe <- fetch probeId
|
||||
deleteRecord probe
|
||||
redirectTo ProbesAction
|
||||
Reference in New Issue
Block a user