mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
fix: unit tests
This commit is contained in:
@@ -161,9 +161,7 @@ export abstract class BaseRepository<
|
||||
}
|
||||
|
||||
async findOneAndPopulate(criteria: string | TFilterQuery<T>) {
|
||||
if (!this.populate || !this.clsPopulate) {
|
||||
throw new Error('Cannot populate query');
|
||||
}
|
||||
this.ensureCanPopulate();
|
||||
const query = this.findOneQuery(criteria).populate(this.populate);
|
||||
return await this.executeOne(query, this.clsPopulate);
|
||||
}
|
||||
|
||||
@@ -10,8 +10,12 @@
|
||||
import { BaseRepository } from './base-repository';
|
||||
import { BaseSchema } from './base-schema';
|
||||
|
||||
export abstract class BaseSeeder<T, P extends string = never> {
|
||||
constructor(protected readonly repository: BaseRepository<T, P>) {}
|
||||
export abstract class BaseSeeder<
|
||||
T,
|
||||
P extends string = never,
|
||||
TFull extends Omit<T, P> = never,
|
||||
> {
|
||||
constructor(protected readonly repository: BaseRepository<T, P, TFull>) {}
|
||||
|
||||
async findAll(): Promise<T[]> {
|
||||
return await this.repository.findAll();
|
||||
|
||||
Reference in New Issue
Block a user