refactor: rm schema arg from QueryBuilder funcs

* Change TableName to QualifiedIdentifier in ReadQuery
  and MutateQuery.

* Move removeSourceCTESchema to DbRequestBuilder.
This commit is contained in:
steve-chavez
2019-10-08 12:41:39 -05:00
committed by Steve Chávez
parent eebe319bfd
commit 50f2cc16ab
5 changed files with 72 additions and 71 deletions
+4 -5
View File
@@ -333,24 +333,23 @@ app dbStructure proc cols conf apiRequest =
topLevelRange = iTopLevelRange apiRequest
returnsScalar = maybe False procReturnsScalar proc
selectQuery = readRequestToQuery schema False
countQuery = readRequestToCountQuery schema
selectQuery = readRequestToQuery False
readSqlParts tableName =
let
readReq = readRequest schema tableName maxRows (dbRelations dbStructure) apiRequest
in
(,,) <$>
(selectQuery <$> readReq) <*>
(countQuery <$> readReq) <*>
(readRequestToCountQuery <$> readReq) <*>
(binaryField contentType rawContentTypes returnsScalar =<< readReq)
mutateSqlParts s t =
let
readReq = readRequest s t maxRows (dbRelations dbStructure) apiRequest
mutReq = mutateRequest apiRequest t cols (tablePKCols dbStructure s t) =<< readReq
mutReq = mutateRequest s t apiRequest cols (tablePKCols dbStructure s t) =<< readReq
in
(,) <$>
(selectQuery <$> readReq) <*>
(mutateRequestToQuery s <$> mutReq)
(mutateRequestToQuery <$> mutReq)
responseContentTypeOrError :: [ContentType] -> [ContentType] -> Action -> Target -> Either Response ContentType
responseContentTypeOrError accepts rawContentTypes action target = serves contentTypesForRequest accepts