This commit is contained in:
2025-11-16 10:37:03 +03:30
parent ad4b2e2c89
commit fae765e05a
8 changed files with 45 additions and 30 deletions
@@ -23,12 +23,12 @@ export class FoodRepository extends EntityRepository<Food> {
* Find foods with pagination and optional filters.
* Supports: search (title/content), categoryId, isActive, ordering.
*/
async findAllPaginated(opts: FindFoodsOpts = {}): Promise<PaginatedResult<Food>> {
async findAllPaginated(restId: string, opts: FindFoodsOpts = {}): Promise<PaginatedResult<Food>> {
const { page = 1, limit = 10, search, orderBy = 'createdAt', order = 'desc', categoryId, isActive } = opts;
const offset = (page - 1) * limit;
const where: FilterQuery<Food> = {};
const where: FilterQuery<Food> = { restaurant: { id: restId } };
if (typeof isActive === 'boolean') {
where.isActive = isActive;