Patch: Throw 404 if row not found
This commit is contained in:
parent
7f1b81dd7a
commit
5fc8299390
|
@ -286,9 +286,7 @@ module External {
|
||||||
if (isNaN(id)) {
|
if (isNaN(id)) {
|
||||||
id = decodeURIComponent(row[key]).match(/\[(.*?)\]/)?.[1]
|
id = decodeURIComponent(row[key]).match(/\[(.*?)\]/)?.[1]
|
||||||
}
|
}
|
||||||
newRow[field.foreignKey || linkTablePrimary] = breakRowIdField(
|
newRow[field.foreignKey || linkTablePrimary] = breakRowIdField(id)[0]
|
||||||
id
|
|
||||||
)[0]
|
|
||||||
}
|
}
|
||||||
// many to many
|
// many to many
|
||||||
else if (field.through) {
|
else if (field.through) {
|
||||||
|
|
|
@ -37,6 +37,9 @@ export async function patch(ctx: any): Promise<any> {
|
||||||
datasourceId: tableId,
|
datasourceId: tableId,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
if (!row) {
|
||||||
|
ctx.throw(404, "Row not found!")
|
||||||
|
}
|
||||||
ctx.status = 200
|
ctx.status = 200
|
||||||
ctx.eventEmitter &&
|
ctx.eventEmitter &&
|
||||||
ctx.eventEmitter.emitRow(`row:update`, appId, row, table)
|
ctx.eventEmitter.emitRow(`row:update`, appId, row, table)
|
||||||
|
|
Loading…
Reference in New Issue