mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-04 00:18:01 +01:00
20 lines
494 B
TypeScript
20 lines
494 B
TypeScript
|
import { Db } from '../../db/db';
|
||
|
import { IFeaturesReadModel } from './features-read-model-type';
|
||
|
|
||
|
export class FeaturesReadModel implements IFeaturesReadModel {
|
||
|
private db: Db;
|
||
|
|
||
|
constructor(db: Db) {
|
||
|
this.db = db;
|
||
|
}
|
||
|
|
||
|
async featureExists(parent: string): Promise<boolean> {
|
||
|
const rows = await this.db('features')
|
||
|
.where('name', parent)
|
||
|
.andWhere('archived_at', null)
|
||
|
.select('name');
|
||
|
|
||
|
return rows.length > 0;
|
||
|
}
|
||
|
}
|