169 21 19 8 6 5 shreyansh yadav - #331
Open
melowdiouss wants to merge 11 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Task Pipeline app across server + client to support multi-file submissions, improve task/submission lifecycle consistency, add server-side JWT revocation via a token blacklist on logout, and introduce a persistent light/dark theme with updated UI styling.
Changes:
- Backend: add token blacklist logout + JWT blacklist enforcement; cascade-delete submissions when deleting tasks; propagate submission review status to parent task.
- Submissions: switch from single-file to multi-file upload end-to-end (routes, controller, model, UI review modal).
- Frontend: introduce ThemeProvider + toggle, and migrate multiple pages/components to theme tokens + updated UI patterns.
Reviewed changes
Copilot reviewed 29 out of 34 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| test_seed.js | Adds a local MongoDB debug script (prints submissions). |
| test_query.js | Adds a local MongoDB debug script (populates task/talent on submissions). |
| server/routes/submissionRoutes.js | Switch submission upload route to upload.array('files', 10). |
| server/routes/authRoutes.js | Adds protected /logout route. |
| server/package-lock.json | Updates locked multer version. |
| server/models/TokenBlacklist.js | New model for storing revoked JWTs with TTL expiry. |
| server/models/Submission.js | Adds fileUrls: [String] to support multi-file submissions. |
| server/middleware/authMiddleware.js | Checks JWT blacklist during protect. |
| server/controllers/taskController.js | Deletes related submissions when deleting a task. |
| server/controllers/submissionController.js | Builds/records multiple file URLs and syncs task status on review. |
| server/controllers/authController.js | Implements logout endpoint that blacklists the current token. |
| client/src/pages/talent/TalentDashboard.jsx | Updates layout and styling to theme-token classes. |
| client/src/pages/RegisterPage.jsx | Updates right-panel styling to theme-token classes. |
| client/src/pages/LoginPage.jsx | Updates right-panel styling to theme-token classes. |
| client/src/pages/admin/SubmissionsPage.jsx | Updates file column to show count of uploaded files. |
| client/src/pages/admin/AdminDashboard.jsx | Updates styling to theme-token classes. |
| client/src/index.css | Introduces light/dark theme variables and applies them to base styles. |
| client/src/context/ThemeContext.jsx | Adds persisted theme context + toggle logic. |
| client/src/context/AuthContext.jsx | Calls server logout endpoint before clearing local auth state. |
| client/src/components/ThemeToggle.jsx | Adds UI control for toggling light/dark theme. |
| client/src/components/talent/TalentSidebar.jsx | Adds theme toggle to sidebar + logout button label + theme styling. |
| client/src/components/talent/SubmitTaskModal.jsx | Switches submission UI from single-file to multi-file upload. |
| client/src/components/talent/MyTasksList.jsx | Updates styling to theme tokens and simplifies hover styling. |
| client/src/components/admin/TasksTable.jsx | Updates styling, empty states, and fallbacks for task fields. |
| client/src/components/admin/SubmissionReviewModal.jsx | Renders multiple submitted file links (with single-file fallback). |
| client/src/components/admin/Sidebar.jsx | Adds theme toggle + logout label + theme styling. |
| client/src/App.jsx | Wraps app with ThemeProvider. |
| client/src/api/axios.js | Updates axios baseURL (and retains auth header interceptor). |
| client/package-lock.json | Updates locked dependencies (notably ESLint-related packages). |
| client/eslint.config.js | Updates flat ESLint config to include react plugin + rules. |
| client/.eslintrc.cjs | Updates legacy ESLint config to include react plugin + rules. |
Files not reviewed (1)
- server/package-lock.json: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
2
to
4
| const API = axios.create({ | ||
| baseURL: 'http://localhost:5000/api', | ||
| baseURL: 'http://localhost:5001/api', | ||
| }); |
| <TalentSidebar /> | ||
|
|
||
| <main className="ml-[220px] flex-1 px-8 py-8" style={{ maxWidth: 'calc(100vw - 220px)' }}> | ||
| <main className="ml-[220px] flex-1 px-8 py-8 w-[calc(100vw-220px)]"> |
Comment on lines
+17
to
+23
| const fileUrls = req.files && req.files.length > 0 | ||
| ? req.files.map(file => `http://localhost:5000/uploads/${file.filename}`) | ||
| : req.body.fileUrls || []; | ||
|
|
||
| // Also save the first file in fileUrl for fallback | ||
| const fileUrl = fileUrls.length > 0 ? fileUrls[0] : (req.body.fileUrl || null); | ||
|
|
Comment on lines
+75
to
+77
| if (token) { | ||
| await TokenBlacklist.create({ token }); | ||
| } |
Comment on lines
11
to
18
| const isBlacklisted = await TokenBlacklist.findOne({ token }); | ||
| if (isBlacklisted) { | ||
| return res.status(401).json({ message: 'Not authorized, token revoked' }); | ||
| } | ||
|
|
||
| const decoded = jwt.verify(token, process.env.JWT_SECRET); | ||
| req.user = await User.findById(decoded.id).select('-password'); | ||
| next(); |
Comment on lines
+2048
to
+2050
| "version": "2.2.0", | ||
| "resolved": "https://registry.npmjs.org/multer/-/multer-2.2.0.tgz", | ||
| "integrity": "sha512-6rdyFg2kLrMh9Jee7/BMPuV9lEAd7lLW2YUpF9/YxR7njyoUwwQ0ZPh3TaIY50Sw6vlyD2HW3wGOkTS4P79xrQ==", |
Comment on lines
+1
to
+7
| const mongoose = require('mongoose'); | ||
| const Submission = require('./server/models/Submission'); | ||
| mongoose.connect('mongodb://localhost:27017/task-pipeline').then(async () => { | ||
| const subs = await Submission.find({}).lean(); | ||
| console.log('Submissions:', subs); | ||
| process.exit(0); | ||
| }); |
Comment on lines
+1
to
+11
| const mongoose = require('mongoose'); | ||
| const Submission = require('./server/models/Submission'); | ||
| const Task = require('./server/models/Task'); | ||
| const User = require('./server/models/User'); | ||
|
|
||
| mongoose.connect('mongodb://localhost:27017/task-pipeline') | ||
| .then(async () => { | ||
| const submissions = await Submission.find({}).populate('taskId').populate('talentId'); | ||
| console.log(JSON.stringify(submissions, null, 2)); | ||
| process.exit(0); | ||
| }); |
Comment on lines
+105
to
+106
| // Update the task status to match the submission review status ('Approved' or 'Rejected') | ||
| await Task.findByIdAndUpdate(submission.taskId._id, { status: reviewStatus }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary (max 3 sentences)
Fixed three bugs: task deletion now cascades to remove orphaned submissions, approving/rejecting a submission updates the parent task's status accordingly, and logout now blacklists the JWT server-side so revoked tokens are rejected instead of remaining valid indefinitely. Added end-to-end multi-file upload support, letting talents submit and admins review multiple files per submission instead of just one. Implemented a persistent light/dark theme system with an animated sidebar toggle, and added a text label to the logout button for clearer affordance.
Checklist
cd client && npm run lint && npm run buildandcd server && npm run lint && npm run buildlocallyShort Demo Video (required)
Required Checklist
Task & Workflow
27-26-22-7-5-pranav-test)master) was pulled immediately before opening this PRQuality & Safety
Checklist Completion Rule
The checklist must be completed after the Pull Request is opened.
Process:
Incomplete or incorrect checklists will result in the PR being closed.