10000 feat: 🔧 add skip param to fetchProblems api · alfaarghya/alfa-leetcode-api@04ea2b3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 04ea2b3

Browse files
committed
feat: 🔧 add skip param to fetchProblems api
1 parent ef395c3 commit 04ea2b3

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

‎src/Controllers/fetchProblems.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Response } from 'express';
22
import { ProblemSetQuestionListData } from '../types';
33

44
const fetchProblems = async (
5-
options: { limit: number; tags: string },
5+
options: { limit: number; skip: number; tags: string },
66
res: Response,
77
formatData: (data: ProblemSetQuestionListData) => {},
88
query: string
@@ -18,7 +18,7 @@ const fetchProblems = async (
1818
query: query,
1919
variables: {
2020
categorySlug: '',
21-
skip: 0,
21+
skip: options.skip || 0,
2222
limit: options.limit || 20, //by default get 20 question
2323
filters: { tags: options.tags ? options.tags.split(' ') : ' ' }, //filter by tags
2424
},

‎src/leetCode.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,15 @@ export const selectProblem = (req: Request, res: Response) => {
114114
};
115115

116116
export const problems = (
117-
req: Request<{}, {}, {}, { limit: number; tags: string }>,
117+
req: Request<{}, {}, {}, { limit: number; skip: number; tags: string }>,
118118
res: Response
119119
) => {
120120
const limit = req.query.limit;
121+
const skip = req.query.skip;
121122
const tags = req.query.tags;
122123

123124
controllers.fetchProblems(
124-
{ limit, tags },
125+
{ limit, skip, tags },
125126
res,
126127
formatUtils.formatProblemsData,
127128
gqlQueries.problemListQuery

0 commit comments

Comments
 (0)
0