_ <- do result <- select $ from $ \(~{selectVar} ~{concatMap joinDef (sqJoins sq)}) -> do ~{indent 12 $ joinExprs} let ~{selectVar}Id' = ~{selectVar} ^. ~{selectEntity}Id ~{indent 12 $ maybeWhere} limit 1 return ~{selectVar} case result of ((Entity _ _):_) -> return () _ -> sendResponseStatus status403 (A.object [ "message" .= ("require condition #~{show requireId} failed" :: Text) ])