Context
I have a record with a field that is of type Day
(which corresponds to a field with type DATE
in my Postgresql database). I have a Create action which works fine (records are saved to the database). However, from the Create action, if I try to redirect to another action and pass in the field with type Day
like:
-- PostsController.hs
action CreatePostAction = do
let post = newRecord @Post
post
|> buildPost
|> ifValid \case
Left post -> do
render NewView { .. }
Right post -> do
let date1 = get #date1 post
redirectTo SomeAction { .. }
I get this error:
Query parameter "date1" needs to be a "UUID" but got "2021-10-16"
Routing failed with: BadType {expectedType = "UUID", value = Just "2021-10-23", field = "date1"}
even though SomeAction
's param type is Day
:
-- Types.hs
data PostsController = SomeAction { date1 :: Day }
Question
Why is the error thrown? And why is the expected type UUID when it should be Day?