Making table required.

This commit is contained in:
Michael Drury 2024-04-16 17:22:17 +01:00
parent ccb56c8788
commit 8b0fc5ed5d
5 changed files with 12 additions and 3 deletions

View File

@ -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
const promises = []
const related = await this.lookupRelations(mainTableId, row)
const table = this.getTable(mainTableId)
const table = this.getTable(mainTableId)!
for (let relationship of relationships) {
const { key, tableId, isUpdate, id, ...rest } = relationship
const body: { [key: string]: any } = processObjectSync(rest, row, {})

View File

@ -22,6 +22,7 @@ export async function makeTableRequest(
operation,
},
meta: {
table,
tables,
},
table,

View File

@ -756,7 +756,7 @@ describe.each(
},
},
meta: {
table: config.table,
table: config.table!,
},
})
expect(res).toHaveLength(1)

View File

@ -66,7 +66,15 @@ function generateUpdateJson({
body = {},
filters = {},
meta = {},
}: {
table: string
body?: any
filters?: any
meta?: any
}): QueryJson {
if (!meta.table) {
meta.table = table
}
return {
endpoint: endpoint(table, "UPDATE"),
filters,

View File

@ -91,7 +91,7 @@ export interface QueryJson {
body?: Row | Row[]
table?: Table
meta: {
table?: Table
table: Table
tables?: Record<string, Table>
renamed?: RenameColumn
}