Update many to many
This commit is contained in:
parent
e0242d0883
commit
b9c54b6fe6
|
@ -629,10 +629,7 @@ export class ExternalRequest {
|
|||
* Creating the specific list of fields that we desire, and excluding the ones that are no use to us
|
||||
* is more performant and has the added benefit of protecting against this scenario.
|
||||
*/
|
||||
buildFields(
|
||||
table: Table,
|
||||
includeRelations: IncludeRelationship = IncludeRelationship.INCLUDE
|
||||
) {
|
||||
buildFields(table: Table, includeRelations: boolean) {
|
||||
function extractRealFields(table: Table, existing: string[] = []) {
|
||||
return Object.entries(table.schema)
|
||||
.filter(
|
||||
|
@ -691,6 +688,10 @@ export class ExternalRequest {
|
|||
}
|
||||
filters = buildFilters(id, filters || {}, table)
|
||||
const relationships = this.buildRelationships(table)
|
||||
|
||||
const includeSqlRelationships =
|
||||
config.includeSqlRelationships === IncludeRelationship.INCLUDE
|
||||
|
||||
// clean up row on ingress using schema
|
||||
const processed = this.inputProcessing(row, table)
|
||||
row = processed.row
|
||||
|
@ -708,9 +709,7 @@ export class ExternalRequest {
|
|||
},
|
||||
resource: {
|
||||
// have to specify the fields to avoid column overlap (for SQL)
|
||||
fields: isSql
|
||||
? this.buildFields(table, config.includeSqlRelationships)
|
||||
: [],
|
||||
fields: isSql ? this.buildFields(table, includeSqlRelationships) : [],
|
||||
},
|
||||
filters,
|
||||
sort,
|
||||
|
|
|
@ -58,7 +58,7 @@ export async function patch(ctx: BBContext) {
|
|||
return handleRequest(Operation.UPDATE, tableId, {
|
||||
id: breakRowIdField(id),
|
||||
row: inputs,
|
||||
includeSqlRelationships: IncludeRelationship.EXCLUDE,
|
||||
includeSqlRelationships: IncludeRelationship.INCLUDE,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -502,9 +502,7 @@ class InternalBuilder {
|
|||
if (opts.disableReturning) {
|
||||
return query.update(parsedBody)
|
||||
} else {
|
||||
return query
|
||||
.update(parsedBody)
|
||||
.returning(generateSelectStatement(json, knex))
|
||||
return query.update(parsedBody).returning("*")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue