mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
Refactor: merge find findPage - findAndPopulate findPageAndPopulate
This commit is contained in:
@@ -68,15 +68,9 @@ export class RoleController extends BaseController<
|
||||
@Query(new SearchFilterPipe<Role>({ allowedFields: ['name'] }))
|
||||
filters: TFilterQuery<Role>,
|
||||
) {
|
||||
if (pageQuery.limit) {
|
||||
return this.canPopulate(populate)
|
||||
? await this.roleService.findPageAndPopulate(filters, pageQuery)
|
||||
: await this.roleService.findPage(filters, pageQuery);
|
||||
}
|
||||
|
||||
return this.canPopulate(populate)
|
||||
? await this.roleService.findAndPopulate(filters, pageQuery.sort)
|
||||
: await this.roleService.find(filters, pageQuery.sort);
|
||||
? await this.roleService.findAndPopulate(filters, pageQuery)
|
||||
: await this.roleService.find(filters, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user