c-code-x / codex-website

https://codex-website-nu.vercel.app
5 stars 17 forks source link

cf-problem-sheet Backend API #75

Closed Harsha9554 closed 7 months ago

Harsha9554 commented 7 months ago

This issue is part of the feature #74

here's a simple design for the API call:

API Endpoint:

GET http://localhost:3000/api/cf-problem-sheet

Query Parameters:

Example Request:

GET http://localhost:3000/api/cf-problem-sheet?handle=harsha9554&minProblemRating=0&maxProblemRating=1400&numberOfPreviousContests=5

Example Response:

{
    "meta": {
        "handle": "harsha9554",
        "minProblemRating": 0,
        "maxProblemRating": 1400,
        "numberOfPreviousContests": 5
    },
    "problems": [
        {
            "contestId": 1903,
            "index": "A",
            "name": "Halloumi Boxes",
            "type": "PROGRAMMING",
            "points": 500,
            "rating": 800,
            "tags": [
                "brute force",
                "greedy",
                "sortings"
            ],
            "verdict": "NONE",
            "URL": "https://codeforces.com/problemset/problem/1903/A"
        },
        {
            "contestId": 1901,
            "index": "A",
            "name": "Line Trip",
            "type": "PROGRAMMING",
            "rating": 800,
            "tags": [
                "greedy",
                "math"
            ],
            "points": 0,
            "verdict": "NONE",
            "URL": "https://codeforces.com/problemset/problem/1901/A"
        },
        {
            "contestId": 1900,
            "index": "A",
            "name": "Cover in Water",
            "type": "PROGRAMMING",
            "points": 500,
            "rating": 800,
            "tags": [
                "constructive algorithms",
                "greedy",
                "implementation",
                "strings"
            ],
            "verdict": "NONE",
            "URL": "https://codeforces.com/problemset/problem/1900/A"
        },
        {
            "contestId": 1900,
            "index": "B",
            "name": "Laura and Operations",
            "type": "PROGRAMMING",
            "points": 1000,
            "rating": 900,
            "tags": [
                "dp",
                "math"
            ],
            "verdict": "NONE",
            "URL": "https://codeforces.com/problemset/problem/1900/B"
        },
        {
            "contestId": 1901,
            "index": "B",
            "name": "Chip and Ribbon",
            "type": "PROGRAMMING",
            "rating": 1100,
            "tags": [
                "greedy",
                "math"
            ],
            "points": 0,
            "verdict": "NONE",
            "URL": "https://codeforces.com/problemset/problem/1901/B"
        },
        {
            "contestId": 1903,
            "index": "B",
            "name": "StORage room",
            "type": "PROGRAMMING",
            "points": 1000,
            "rating": 1200,
            "tags": [
                "bitmasks",
                "brute force",
                "constructive algorithms",
                "greedy"
            ],
            "verdict": "NONE",
            "URL": "https://codeforces.com/problemset/problem/1903/B"
        },
        {
            "contestId": 1900,
            "index": "C",
            "name": "Anji's Binary Tree",
            "type": "PROGRAMMING",
            "points": 1250,
            "rating": 1300,
            "tags": [
                "dfs and similar",
                "dp",
                "trees"
            ],
            "verdict": "NONE",
            "URL": "https://codeforces.com/problemset/problem/1900/C"
        },
        {
            "contestId": 1903,
            "index": "C",
            "name": "Theofanis' Nightmare",
            "type": "PROGRAMMING",
            "points": 1500,
            "rating": 1400,
            "tags": [
                "constructive algorithms",
                "dp",
                "fft",
                "greedy",
                "hashing"
            ],
            "verdict": "NONE",
            "URL": "https://codeforces.com/problemset/problem/1903/C"
        },
        {
            "contestId": 1901,
            "index": "C",
            "name": "Add, Divide and Floor",
            "type": "PROGRAMMING",
            "rating": 1400,
            "tags": [
                "constructive algorithms",
                "greedy",
                "math"
            ],
            "points": 0,
            "verdict": "NONE",
            "URL": "https://codeforces.com/problemset/problem/1901/C"
        }
    ]
}

This design provides a clear structure for the API call, specifying required and optional parameters, along with an example request and response for better understanding. @Jaideep-C

Jaideep-C commented 7 months ago

What happens when minProblemRating is absent? What value are you choosing?

Harsha9554 commented 7 months ago

So, the way I've written the logic is that if you don't pass minProblemRating or the value for minProblemRating is not given by the user the default minProblemRating is 0. @Jaideep-C

Jaideep-C commented 7 months ago

This issue is resolved in #76