MF
Size: a a a
MF
JS
DB
JS
OS
/Allure/GameDefinition/game-src/TieKnot.hs:45:1: error:
Ambiguous module name ‘Content.PlaceKind’:
it was found in multiple packages:
Allure-0.10.2.0 LambdaHack-0.10.2.0
OS
m
curl 'http://localhost:3003/api/private/itinerary/77' -H 'Content-Type: application/json' --data-raw '{"plan_id":270031,"country":"belize"}' --verbose
Насколько я понимаю, должно прийти в этот Endpoint:type UpdateById = Capture "id" ItineraryId :> PostWithValidation Itinerary ItineraryНо вот до
updateById :: AppSessionServer UpdateById
updateById id Itinerary{..} = do
liftIO $ putStrLn ("~~~~~~~ updateById ~~~~~~~~~~~~~~~" :: P.String)
runExceptT $ doDb $ do
suid <- requireLoggedInUser
requireAuth (hasCountryRole Reservations itineraryCountry)
pgUpdate id [ ItineraryTrip_name =. itineraryTrip_name
, ItineraryLast_user_id =. Just suid
]
newRec <- pgGet404 id
pure newRec
putStrLn
дело вообще не доходит.--data-raw '{"plan_id":270031}' (`country
обязательно поле) то сервер отвечает ошибкой. Если запустить stack ghci
и там сделать JSON.decode "{\"plan_id\":270031,\"country\":\"belize\"} :: Itinerary
-- то распарсивает. Поэтому я делаю вывод, что хотя бы парсинг работает корректно.m
type GetItineraryById = Capture "id" ItineraryId :> GetJSON (Entity Itinerary)
-- | pgGet just an itinerary
getById :: AppSessionServer GetItineraryById
getById id = do
liftIO $ putStrLn ("~~~~~~~ getById ~~~~~~~~~~~~~~~" :: P.String)
rec <- doDb $ pgGet404 id
requireAuth (hasCountryRole Reservations (itineraryCountry rec))
pure $ Entity id rec
JS
JS
JS
¯
class SectorGetter a where
getSector :: a -> Integer -> Integer -> BL.ByteString
a = ByteString
, то всё хорошо, но если a = Handle
, то придётся возвращать IO ByteString
, что не соответствует сигнатуре. может, тогда не пытаться писать единый интерфейс, а всё-таки написать две реализации (пусть, они и будут почти идентичны)?JS
m
traceStack
, это вот это место:myPrivateApp :: AppResources -> Vault.Key (S.Session IO Text ByteString) -> Middleware -> Application
myPrivateApp resources sessKey sessMiddleware =
sessMiddleware $ \req resF -> do
let sess = fromMaybe (error "Can't find session in vault. Configuration error.") (Vault.lookup sessKey (vault req))
let resF' = \res ->
let res' = mapResponseHeaders (\hdrs -> (hCacheControl,"private, no-cache, no-store, must-revalidate"):hdrs) res
in resF res'
serve myPrivateAPI (hoistServer myPrivateAPI (runAppSessionCtxNT resources sess) myPrivateServer) req resF'
JS