refactor: OpenAPI as Response submodule

* body after dbstructure
* rename runPgLocals to setPgLocals
This commit is contained in:
steve-chavez
2022-10-01 11:05:49 -05:00
committed by Steve Chavez
parent f54dc2e20e
commit fd67c8480c
5 changed files with 12 additions and 12 deletions
+3 -3
View File
@@ -167,8 +167,6 @@ postgrestResponse
-> Wai.Request
-> Handler IO Wai.Response
postgrestResponse appState conf@AppConfig{..} maybeDbStructure jsonDbS pgVer AuthResult{..} req = do
body <- lift $ Wai.strictRequestBody req
dbStructure <-
case maybeDbStructure of
Just dbStructure ->
@@ -176,6 +174,8 @@ postgrestResponse appState conf@AppConfig{..} maybeDbStructure jsonDbS pgVer Aut
Nothing ->
throwError Error.NoSchemaCacheError
body <- lift $ Wai.strictRequestBody req
apiRequest <-
liftEither . mapLeft Error.ApiRequestError $
ApiRequest.userApiRequest conf dbStructure req body
@@ -187,7 +187,7 @@ postgrestResponse appState conf@AppConfig{..} maybeDbStructure jsonDbS pgVer Aut
else
runDbHandler appState (Query.txMode apiRequest) (Just authRole /= configDbAnonRole) configDbPreparedStatements .
Middleware.optionalRollback conf apiRequest $ do
Query.runPgLocals conf authClaims authRole apiRequest jsonDbS pgVer
Query.setPgLocals conf authClaims authRole apiRequest jsonDbS pgVer
handleRequest (ctx apiRequest)
runDbHandler :: AppState.AppState -> SQL.Mode -> Bool -> Bool -> DbHandler b -> Handler IO b