Addressing PR comments.
This commit is contained in:
parent
70ab14319d
commit
00048a2d3e
|
@ -326,17 +326,13 @@ class InternalBuilder {
|
|||
}
|
||||
|
||||
private parseBody(body: Record<string, any>) {
|
||||
try {
|
||||
for (let [key, value] of Object.entries(body)) {
|
||||
const { column } = this.splitter.run(key)
|
||||
const schema = this.table.schema[column]
|
||||
if (!schema) {
|
||||
continue
|
||||
}
|
||||
body[key] = this.parse(value, schema)
|
||||
for (let [key, value] of Object.entries(body)) {
|
||||
const { column } = this.splitter.run(key)
|
||||
const schema = this.table.schema[column]
|
||||
if (!schema) {
|
||||
continue
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
body[key] = this.parse(value, schema)
|
||||
}
|
||||
return body
|
||||
}
|
||||
|
|
|
@ -671,6 +671,7 @@ export class ExternalRequest<T extends Operation> {
|
|||
config.includeSqlRelationships === IncludeRelationship.INCLUDE
|
||||
|
||||
// clean up row on ingress using schema
|
||||
const unprocessedRow = config.row
|
||||
const processed = this.inputProcessing(row, table)
|
||||
row = processed.row
|
||||
let manyRelationships = processed.manyRelationships
|
||||
|
@ -750,9 +751,10 @@ export class ExternalRequest<T extends Operation> {
|
|||
// we might still need to perform other operations like updating the foreign keys on other rows
|
||||
if (
|
||||
this.operation === Operation.UPDATE &&
|
||||
Object.keys(row || {}).length === 0
|
||||
Object.keys(row || {}).length === 0 &&
|
||||
unprocessedRow
|
||||
) {
|
||||
response = [config.row!]
|
||||
response = [unprocessedRow]
|
||||
} else {
|
||||
response = env.SQL_ALIASING_DISABLE
|
||||
? await getDatasourceAndQuery(json)
|
||||
|
|
|
@ -1138,6 +1138,7 @@ describe.each([
|
|||
status: 200,
|
||||
})
|
||||
expect(afterRelatedRow.relationship.length).toEqual(1)
|
||||
expect(afterRelatedRow.relationship[0]._id).toEqual(row._id)
|
||||
})
|
||||
|
||||
it("should be able to update relationships when both columns are same name", async () => {
|
||||
|
|
Loading…
Reference in New Issue