Skip to content

leetcode leaderboard page#1981

Open
adarshm11 wants to merge 33 commits intodevfrom
sign2
Open

leetcode leaderboard page#1981
adarshm11 wants to merge 33 commits intodevfrom
sign2

Conversation

@adarshm11
Copy link
Copy Markdown
Contributor

@adarshm11 adarshm11 commented Dec 31, 2025

Summary

This PR includes a page and API for managing the LeetCode Leaderboard (sign2) from Clark.

Features

  • The leaderboard management page can be accessed from the admin navbar. Officers and admins can add/remove users, and view a preview of what the leaderboard currently looks like.
  • The API includes routes to add, delete, and fetch all users, as well as utility functions to perform these actions on the actual sign2 server.
  • Unit tests are included - however, these only test that the API routes behave correctly regarding JWT authentication, and does not test the routes' behavior with actually performing requests to sign2. This is because the sign2 connection is behind a gateway controlled by config.json, where users can set whether it is enabled or not. In the future, further unit tests should be added to address these conditions.

Testing

This feature has been tested on the production server, where all functions work correctly. Ensure that, after merging, the sign2-specific data in /api/config/config.json matches what is expected to make sign2 reachable from Clark.

Copy link
Copy Markdown
Member

@n8thantran n8thantran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Comment thread api/config/config.example.json Outdated
Comment thread api/main_endpoints/routes/LeetCodeLeaderboard.js Outdated
Comment thread api/main_endpoints/routes/LeetCodeLeaderboard.js Outdated
Comment thread src/Pages/LeetCodeLeaderboard/LeetCodeLeaderboard.js Outdated
Copy link
Copy Markdown
Collaborator

@evanugarte evanugarte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this pr could probably be way less code, see comment

Comment thread api/config/config.example.json Outdated
Comment thread api/main_endpoints/routes/LeetCodeLeaderboard.js
const axios = require('axios');
const LEETCODE_LED_SIGN_URL = process.env.LEETCODE_LED_SIGN_URL || 'http://localhost:12121';

router.get('/', async (req, res) => {
Copy link
Copy Markdown
Collaborator

@evanugarte evanugarte Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this file could be even less

like

app.route('/:id')
  .get((req, res) => {
    const userId = req.params.id; // Access dynamic parameter
  })
  .post((req, res) => {
    const userId = req.params.id;
  });

you could probably make a single callback, and pass it in to both .get and .post

like

function idk(req, res) {
  // ...
}

app.route('/users/:id')
  .get(idk)
  .post(idk);

change :id with :path or something

}
};

router.get('/', async (req, res) => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this code still, if we have the router.use

does router.use take care of all this stuff now

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image we can do it like this but it doesn't seem aesthetically pleasing to me, thoughts

Comment thread src/Components/Navbar/AdminNavbar.js Outdated
Comment thread nginx.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants