product pagination
This commit is contained in:
parent
4972241bf7
commit
1cbdaca757
@ -508,8 +508,8 @@ export const getAllProductAdmin = async (req, res) => {
|
||||
export const getAllProductUser = async (req, res) => {
|
||||
try {
|
||||
// Set default values for pagination
|
||||
const PAGE_SIZE = parseInt(req.query?.show || "10");
|
||||
const page = parseInt(req.query?.page || "1") - 1;
|
||||
// const PAGE_SIZE = parseInt(req.query?.show || "10");
|
||||
// const page = parseInt(req.query?.page || "1") - 1;
|
||||
let filter = {};
|
||||
|
||||
// Filter by category name
|
||||
@ -553,8 +553,8 @@ export const getAllProductUser = async (req, res) => {
|
||||
path: "category addedBy brand",
|
||||
select: "categoryName name brandName",
|
||||
})
|
||||
.limit(PAGE_SIZE)
|
||||
.skip(PAGE_SIZE * page)
|
||||
// .limit(PAGE_SIZE)
|
||||
// .skip(PAGE_SIZE * page)
|
||||
.sort({ createdAt: -1 })
|
||||
.exec();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user