Open michaelfliegner opened 3 years ago
This type was added to support JSONB in Postgres, but wasn't really intended for use in GUI forms. It would definitely be better if it worked, though.
There is a deeper issue underneath: IHP's philosophy seems to be to always have a running system. Which makes it so appealing for beginners and that is a great feature. Maybe due to this approach, IHP's codegenerator is a tad simplistic in that it implies, that fields are generally intended for use in GUI forms.
For a more principled approach there should be metadata
Definitely. We should make it work as a text input field accepting JSON. I can look into it.
Hey! A text field is not necessary. It's just that the build
I built a workaround, like this
buildWorkflow :: (ParamReader fieldType1, ParamReader fieldType2, ParamReader fieldType3, ParamReader fieldType4, HasField "meta" t2 MetaBag, SetField "historyType" t2 fieldType2, SetField "meta" t2 MetaBag, SetField "progress" t2 value, SetField "refuser" t2 fieldType1, SetField "validfrom" t2 fieldType4, SetField "workflowType" t2 fieldType3, FromJSON value, ?context::ControllerContext) => t2 -> t2
buildWorkflow workflow = workflow
|> fill @["refuser","historyType","workflowType","validfrom"] |> set #progress val
where val =fromJust $ decode $ fromStrict $ param @Web.Controller.Prelude.ByteString "progress"
but JSONB-ParamReader instance would be nicer :-)
To reproduce: 1.
-- Your database schema. Use the Schema Designer at http://localhost:8001/ to add some tables. CREATE TABLE workflows ( id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL, progress JSONB NOT NULL );
2. Generate Controller Workflows and start server
Error message: