1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-04 00:18:01 +01:00
unleash.unleash/src/lib/features/feature-toggle/features-read-model.ts

20 lines
500 B
TypeScript
Raw Normal View History

import { Db } from '../../db/db';
import { IFeaturesReadModel } from './types/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;
}
}