diff --git a/plugins/catalog-backend/src/database/Database.ts b/plugins/catalog-backend/src/database/Database.ts index 9b37980c04..04755e8f4d 100644 --- a/plugins/catalog-backend/src/database/Database.ts +++ b/plugins/catalog-backend/src/database/Database.ts @@ -28,7 +28,7 @@ export class Database { constructor(private readonly database: Knex) {} async addOrUpdateComponent(component: AddDatabaseComponent): Promise { - await this.database.transaction(async tx => { + await this.database.transaction(async (tx) => { // TODO(freben): Currently, several locations can compete for the same component // TODO(freben): If locationId is unset in the input, it won't be overwritten - should we instead replace with null? const count = await tx('components') @@ -60,7 +60,7 @@ export class Database { } async addLocation(location: AddDatabaseLocation): Promise { - return await this.database.transaction(async tx => { + return await this.database.transaction(async (tx) => { const existingLocation = await tx('locations') .where({ target: location.target, @@ -80,9 +80,7 @@ export class Database { }); return ( - await tx('locations') - .where({ id }) - .select() + await tx('locations').where({ id }).select() )?.[0]; }); } @@ -107,12 +105,6 @@ export class Database { return items[0]; } - private async locationByTarget( - target: string, - ): Promise { - return (await this.locations()).find(l => l.target === target); - } - async locations(): Promise { return await this.database('locations').select(); }