refactor: split preference parsing from userApiRequest

This allows obtaining the preferences header before doing the full parse
on userApiRequest. Which is needed by #3507.
This commit is contained in:
steve-chavez
2025-05-02 19:04:02 -05:00
committed by Steve Chavez
parent bf79766a9b
commit b58253833b
2 changed files with 10 additions and 6 deletions
+2 -1
View File
@@ -145,8 +145,9 @@ postgrestResponse appState conf@AppConfig{..} maybeSchemaCache pgVer authResult@
let jwtTime = if configServerTimingEnabled then Auth.getJwtDur req else Nothing
timezones = dbTimezones sCache
prefs = ApiRequest.userPreferences conf req timezones
(parseTime, apiReq@ApiRequest{..}) <- withTiming $ liftEither . mapLeft Error.ApiRequestError $ ApiRequest.userApiRequest conf req body timezones
(parseTime, apiReq@ApiRequest{..}) <- withTiming $ liftEither . mapLeft Error.ApiRequestError $ ApiRequest.userApiRequest conf prefs req body
(planTime, plan) <- withTiming $ liftEither $ Plan.actionPlan iAction conf apiReq sCache
let query = Query.query conf authResult apiReq plan sCache pgVer