Skip to content

Commit

Permalink
feat: 🔧 add skip param to fetchProblems api
Browse files Browse the repository at this point in the history
  • Loading branch information
ajchili committed Jul 14, 2024
1 parent ef395c3 commit 04ea2b3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Controllers/fetchProblems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Response } from 'express';
import { ProblemSetQuestionListData } from '../types';

const fetchProblems = async (
options: { limit: number; tags: string },
options: { limit: number; skip: number; tags: string },
res: Response,
formatData: (data: ProblemSetQuestionListData) => {},
query: string
Expand All @@ -18,7 +18,7 @@ const fetchProblems = async (
query: query,
variables: {
categorySlug: '',
skip: 0,
skip: options.skip || 0,
limit: options.limit || 20, //by default get 20 question
filters: { tags: options.tags ? options.tags.split(' ') : ' ' }, //filter by tags
},
Expand Down
5 changes: 3 additions & 2 deletions src/leetCode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,15 @@ export const selectProblem = (req: Request, res: Response) => {
};

export const problems = (
req: Request<{}, {}, {}, { limit: number; tags: string }>,
req: Request<{}, {}, {}, { limit: number; skip: number; tags: string }>,
res: Response
) => {
const limit = req.query.limit;
const skip = req.query.skip;
const tags = req.query.tags;

controllers.fetchProblems(
{ limit, tags },
{ limit, skip, tags },
res,
formatUtils.formatProblemsData,
gqlQueries.problemListQuery
Expand Down

0 comments on commit 04ea2b3

Please sign in to comment.