From a06037625d80f51a9e956ef9cf9172a3c093be36 Mon Sep 17 00:00:00 2001 From: Mateusz Kwasniewski Date: Wed, 27 Sep 2023 15:17:04 +0200 Subject: [PATCH] refactor: expicit names in queries (#4850) --- .../dependent-features-read-model.ts | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/lib/features/dependent-features/dependent-features-read-model.ts b/src/lib/features/dependent-features/dependent-features-read-model.ts index 74eade15ca..a95fd3a20b 100644 --- a/src/lib/features/dependent-features/dependent-features-read-model.ts +++ b/src/lib/features/dependent-features/dependent-features-read-model.ts @@ -29,18 +29,22 @@ export class DependentFeaturesReadModel implements IDependentFeaturesReadModel { } async getParentOptions(child: string): Promise { - const result = await this.db('features as f') - .where('f.name', child) - .select('f.project'); + const result = await this.db('features') + .where('features.name', child) + .select('features.project'); if (result.length === 0) { return []; } - const rows = await this.db('features as f') - .leftJoin('dependent_features as df', 'f.name', 'df.child') - .where('f.project', result[0].project) - .andWhere('f.name', '!=', child) - .andWhere('df.child', null) - .select('f.name'); + const rows = await this.db('features') + .leftJoin( + 'dependent_features', + 'features.name', + 'dependent_features.child', + ) + .where('features.project', result[0].project) + .andWhere('features.name', '!=', child) + .andWhere('dependent_features.child', null) + .select('features.name'); return rows.map((item) => item.name); }