fix(catalog-backend): make location delete work again

This commit is contained in:
Fredrik Adelöw
2020-06-15 13:25:57 +02:00
parent 1855bf381b
commit 8f82336198
@@ -390,6 +390,10 @@ export class CommonDatabase implements Database {
async removeLocation(txOpaque: unknown, id: string): Promise<void> {
const tx = txOpaque as Knex.Transaction<any, any>;
await tx<DbEntitiesRow>('entities')
.where({ location_id: id })
.update({ location_id: null });
const result = await tx<DbLocationsRow>('locations').where({ id }).del();
if (!result) {