mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-14 00:19:16 +01:00
refactor: expicit names in queries (#4850)
This commit is contained in:
parent
d3e01d84d9
commit
a06037625d
@ -29,18 +29,22 @@ export class DependentFeaturesReadModel implements IDependentFeaturesReadModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getParentOptions(child: string): Promise<string[]> {
|
async getParentOptions(child: string): Promise<string[]> {
|
||||||
const result = await this.db('features as f')
|
const result = await this.db('features')
|
||||||
.where('f.name', child)
|
.where('features.name', child)
|
||||||
.select('f.project');
|
.select('features.project');
|
||||||
if (result.length === 0) {
|
if (result.length === 0) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
const rows = await this.db('features as f')
|
const rows = await this.db('features')
|
||||||
.leftJoin('dependent_features as df', 'f.name', 'df.child')
|
.leftJoin(
|
||||||
.where('f.project', result[0].project)
|
'dependent_features',
|
||||||
.andWhere('f.name', '!=', child)
|
'features.name',
|
||||||
.andWhere('df.child', null)
|
'dependent_features.child',
|
||||||
.select('f.name');
|
)
|
||||||
|
.where('features.project', result[0].project)
|
||||||
|
.andWhere('features.name', '!=', child)
|
||||||
|
.andWhere('dependent_features.child', null)
|
||||||
|
.select('features.name');
|
||||||
|
|
||||||
return rows.map((item) => item.name);
|
return rows.map((item) => item.name);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user