🔧 Fixed the paginated result of getComicsMarkedAsWanted
This commit is contained in:
@@ -339,6 +339,9 @@ export default class LibraryService extends Service {
|
|||||||
ctx: Context<{ page: number; limit: number }>
|
ctx: Context<{ page: number; limit: number }>
|
||||||
) => {
|
) => {
|
||||||
const { page, limit } = ctx.params;
|
const { page, limit } = ctx.params;
|
||||||
|
this.logger.info(
|
||||||
|
`Requesting page ${page} with limit ${limit}`
|
||||||
|
);
|
||||||
try {
|
try {
|
||||||
const options = {
|
const options = {
|
||||||
page,
|
page,
|
||||||
@@ -364,15 +367,15 @@ export default class LibraryService extends Service {
|
|||||||
options
|
options
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
// Log the raw result from the database
|
||||||
wantedComics: result.docs,
|
this.logger.info(
|
||||||
total: result.totalDocs,
|
"Paginate result:",
|
||||||
page: result.page,
|
JSON.stringify(result, null, 2)
|
||||||
limit: result.limit,
|
);
|
||||||
pages: result.totalPages,
|
|
||||||
};
|
return result.docs; // Return just the docs array
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error finding comics:", error);
|
this.logger.error("Error finding comics:", error);
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user