Skip to content

Fixes #68 : Implemented NewProblem page #69

Merged
Kmadhav824 merged 2 commits into
shivamxverma:mainfrom
Kmadhav824:Problem-Page
May 15, 2026
Merged

Fixes #68 : Implemented NewProblem page #69
Kmadhav824 merged 2 commits into
shivamxverma:mainfrom
Kmadhav824:Problem-Page

Conversation

@Kmadhav824
Copy link
Copy Markdown
Collaborator

New Problem Page was integrated, admins can start creating the problems

Copilot AI review requested due to automatic review settings May 15, 2026 18:30
@vercel
Copy link
Copy Markdown

vercel Bot commented May 15, 2026

@Kmadhav824 is attempting to deploy a commit to the Shivam verma's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Kmadhav824 Kmadhav824 merged commit f8e9b2e into shivamxverma:main May 15, 2026
6 of 7 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR wires up the admin "New Problem" page in the frontend, renaming the route/component to CreateProblem//createproblem, and also bundles several unrelated backend tweaks: a tsconfig module change, ESM __dirname handling in config/index.ts, relaxed validation on editorialContent/editorialLink/tags in the problem schema, a rewrite of seed-admin.js to use the Drizzle schema, and a commented-out import in contest.route.ts.

Changes:

  • Frontend: rename NewProblem import/route to CreateProblem and update navbar link to /createProblem; cosmetic JSX/whitespace cleanup in NavBar.jsx.
  • Backend: loosen createProblemSchema (editorial fields + tags now optional with defaults); rewrite seed-admin.js against the Drizzle user table; switch tsconfig to node16 modules; add ESM __dirname shim in config/index.ts.
  • Backend: comment out verifyJWT import in contest.route.ts.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
Frontend/src/App.jsx Rename import to CreateProblem and route path to /createproblem.
Frontend/src/components/NavBar.jsx Update admin/author nav link to /createProblem; whitespace/formatting tweaks.
backend/src/api/problem/problem-schema.ts Make editorialContent, editorialLink, and tags optional with defaults.
backend/src/api/contest/contest.route.ts Comment out the remaining verifyJWT import, leaving the file with no exports.
backend/src/config/index.ts Add ESM-compatible __dirname derivation via import.meta.url; whitespace reformatting.
backend/src/scripts/seed-admin.js Replace Mongoose User model with Drizzle user table and tidy formatting (but uses non-existent findOne/create methods).
backend/tsconfig.json Change module/moduleResolution from commonjs/node to node16.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +2 to 26
import { user } from "../db/schema.ts";
import env from '../config/index.ts'

export async function seedAdmin() {

const adminExists = await User.findOne({ role: "admin" });
const adminExists = await user.findOne({ role: "ADMIN" });
if (adminExists) {
console.log("Admin already exists. Skipping.");
process.exit(0);
}

const { ADMIN_USERNAME,ADMIN_FULLNAME, ADMIN_EMAIL, ADMIN_PASSWORD } = env;
const { ADMIN_USERNAME, ADMIN_FULLNAME, ADMIN_EMAIL, ADMIN_PASSWORD } = env;
if (!ADMIN_EMAIL || !ADMIN_PASSWORD) {
throw new Error("ADMIN_EMAIL / ADMIN_PASSWORD missing");
}

const passwordHash = await bcrypt.hash(ADMIN_PASSWORD, 12);

await User.create({
await user.create({
username: ADMIN_USERNAME,
fullName : ADMIN_FULLNAME,
fullName: ADMIN_FULLNAME,
email: ADMIN_EMAIL,
password : passwordHash,
password: passwordHash,
role: "admin",
});
{ to: "/newproblem", label: "Create Problem" },
{ to: "/contests/create", label: "Create Contest" },
]
{ to: "/createProblem", label: "Create Problem" },
editorialLink: yup.string().optional().default(""),
solution: yup.string().required("Solution is required"),
tags: yup.array().of(yup.string()).required("Tags is required"),
tags: yup.array().of(yup.string()).optional().default([]),
Comment thread backend/tsconfig.json
Comment on lines +13 to +14
"moduleResolution": "node16",
"module": "node16",
// import {createContest,getAllContests,getContestById,getClock,getLeaderboard,registerContest} from "./contest.controller.js"
// import { Router } from 'express';
import { verifyJWT } from '../../middlewares/auth.middleware.js';
// import { verifyJWT } from '../../middlewares/auth.middleware.js';
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.

2 participants