Making table required.
This commit is contained in:
parent
ccb56c8788
commit
8b0fc5ed5d
|
@ -437,7 +437,7 @@ export class ExternalRequest<T extends Operation> {
|
||||||
// if we're creating (in a through table) need to wipe the existing ones first
|
// if we're creating (in a through table) need to wipe the existing ones first
|
||||||
const promises = []
|
const promises = []
|
||||||
const related = await this.lookupRelations(mainTableId, row)
|
const related = await this.lookupRelations(mainTableId, row)
|
||||||
const table = this.getTable(mainTableId)
|
const table = this.getTable(mainTableId)!
|
||||||
for (let relationship of relationships) {
|
for (let relationship of relationships) {
|
||||||
const { key, tableId, isUpdate, id, ...rest } = relationship
|
const { key, tableId, isUpdate, id, ...rest } = relationship
|
||||||
const body: { [key: string]: any } = processObjectSync(rest, row, {})
|
const body: { [key: string]: any } = processObjectSync(rest, row, {})
|
||||||
|
|
|
@ -22,6 +22,7 @@ export async function makeTableRequest(
|
||||||
operation,
|
operation,
|
||||||
},
|
},
|
||||||
meta: {
|
meta: {
|
||||||
|
table,
|
||||||
tables,
|
tables,
|
||||||
},
|
},
|
||||||
table,
|
table,
|
||||||
|
|
|
@ -756,7 +756,7 @@ describe.each(
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
meta: {
|
meta: {
|
||||||
table: config.table,
|
table: config.table!,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
expect(res).toHaveLength(1)
|
expect(res).toHaveLength(1)
|
||||||
|
|
|
@ -66,7 +66,15 @@ function generateUpdateJson({
|
||||||
body = {},
|
body = {},
|
||||||
filters = {},
|
filters = {},
|
||||||
meta = {},
|
meta = {},
|
||||||
|
}: {
|
||||||
|
table: string
|
||||||
|
body?: any
|
||||||
|
filters?: any
|
||||||
|
meta?: any
|
||||||
}): QueryJson {
|
}): QueryJson {
|
||||||
|
if (!meta.table) {
|
||||||
|
meta.table = table
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
endpoint: endpoint(table, "UPDATE"),
|
endpoint: endpoint(table, "UPDATE"),
|
||||||
filters,
|
filters,
|
||||||
|
|
|
@ -91,7 +91,7 @@ export interface QueryJson {
|
||||||
body?: Row | Row[]
|
body?: Row | Row[]
|
||||||
table?: Table
|
table?: Table
|
||||||
meta: {
|
meta: {
|
||||||
table?: Table
|
table: Table
|
||||||
tables?: Record<string, Table>
|
tables?: Record<string, Table>
|
||||||
renamed?: RenameColumn
|
renamed?: RenameColumn
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue