mirror of
https://github.com/hexastack/hexabot
synced 2025-01-22 10:35:37 +00:00
fix: use overloading to marke deprecated methods signatures
This commit is contained in:
parent
d3b5070407
commit
d912042f88
@ -275,12 +275,26 @@ export abstract class BaseRepository<
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
async find(
|
||||
filter: TFilterQuery<T>,
|
||||
pageQuery?: QuerySortDto<T>,
|
||||
projection?: ProjectionType<T>,
|
||||
): Promise<T[]>;
|
||||
|
||||
async find(
|
||||
filter: TFilterQuery<T>,
|
||||
// TODO: QuerySortDto<T> type need to be removed
|
||||
pageQuery?: QuerySortDto<T> | PageQueryDto<T>,
|
||||
projection?: ProjectionType<T>,
|
||||
) {
|
||||
): Promise<T[]>;
|
||||
|
||||
async find(
|
||||
filter: TFilterQuery<T>,
|
||||
pageQuery?: QuerySortDto<T> | PageQueryDto<T>,
|
||||
projection?: ProjectionType<T>,
|
||||
): Promise<T[]> {
|
||||
const query = this.findQuery(filter, pageQuery, projection);
|
||||
return await this.execute(query, this.cls);
|
||||
}
|
||||
@ -291,12 +305,26 @@ export abstract class BaseRepository<
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
async findAndPopulate(
|
||||
filters: TFilterQuery<T>,
|
||||
pageQuery?: QuerySortDto<T>,
|
||||
projection?: ProjectionType<T>,
|
||||
): Promise<TFull[]>;
|
||||
|
||||
async findAndPopulate(
|
||||
filters: TFilterQuery<T>,
|
||||
pageQuery?: PageQueryDto<T>,
|
||||
projection?: ProjectionType<T>,
|
||||
): Promise<TFull[]>;
|
||||
|
||||
async findAndPopulate(
|
||||
filters: TFilterQuery<T>,
|
||||
// TODO: QuerySortDto<T> need to be removed
|
||||
pageQuery?: QuerySortDto<T> | PageQueryDto<T>,
|
||||
projection?: ProjectionType<T>,
|
||||
) {
|
||||
): Promise<TFull[]> {
|
||||
this.ensureCanPopulate();
|
||||
const query = this.findQuery(filters, pageQuery, projection).populate(
|
||||
this.populate,
|
||||
|
@ -44,21 +44,59 @@ export abstract class BaseService<
|
||||
return await this.repository.findOneAndPopulate(criteria, projection);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
async find(
|
||||
filter: TFilterQuery<T>,
|
||||
pageQuery?: QuerySortDto<T>,
|
||||
projection?: ProjectionType<T>,
|
||||
): Promise<T[]>;
|
||||
|
||||
async find(
|
||||
filter: TFilterQuery<T>,
|
||||
pageQuery?: PageQueryDto<T>,
|
||||
projection?: ProjectionType<T>,
|
||||
): Promise<T[]>;
|
||||
|
||||
async find(
|
||||
filter: TFilterQuery<T>,
|
||||
// TODO: QuerySortDto<T> type need to be removed
|
||||
pageQuery?: QuerySortDto<T> | PageQueryDto<T>,
|
||||
projection?: ProjectionType<T>,
|
||||
): Promise<T[]> {
|
||||
if (Array.isArray(pageQuery))
|
||||
return await this.repository.find(filter, pageQuery, projection);
|
||||
|
||||
return await this.repository.find(filter, pageQuery, projection);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
async findAndPopulate(
|
||||
filters: TFilterQuery<T>,
|
||||
pageQuery?: QuerySortDto<T>,
|
||||
projection?: ProjectionType<T>,
|
||||
): Promise<TFull[]>;
|
||||
|
||||
async findAndPopulate(
|
||||
filters: TFilterQuery<T>,
|
||||
pageQuery?: PageQueryDto<T>,
|
||||
projection?: ProjectionType<T>,
|
||||
): Promise<TFull[]>;
|
||||
|
||||
async findAndPopulate(
|
||||
filters: TFilterQuery<T>,
|
||||
// TODO: QuerySortDto<T> type need to be removed
|
||||
pageQuery?: QuerySortDto<T> | PageQueryDto<T>,
|
||||
projection?: ProjectionType<T>,
|
||||
) {
|
||||
): Promise<TFull[]> {
|
||||
if (Array.isArray(pageQuery))
|
||||
return await this.repository.findAndPopulate(
|
||||
filters,
|
||||
pageQuery,
|
||||
projection,
|
||||
);
|
||||
|
||||
return await this.repository.findAndPopulate(
|
||||
filters,
|
||||
pageQuery,
|
||||
|
Loading…
Reference in New Issue
Block a user