-
Notifications
You must be signed in to change notification settings - Fork 55
Open
Open
Copy link
Labels
Description
Description
This feature introduces a structured Project Management layer to the application. It allows organizational leaders to delegate tasks, set deadlines, and monitor progress. The system is designed to mirror the actual hierarchy of the institute, ensuring that assignments follow a strict chain of command.
1. The Hierarchy Rules (Assignee Scoping)
The "Assign To" dropdown in the frontend must be dynamically filtered based on the logged-in user's role to prevent unauthorized assignments:
- PRESIDENT: Can assign tasks to any user with a role of
GENSEC_*,CLUB_COORDINATOR, or anyPositionHolder. - GENSEC (e.g., SciTech): Can only assign tasks to Coordinators or Position Holders whose organizational unit belongs to the
'scitech'category. - CLUB COORDINATOR: Can only assign tasks to Position Holders belonging specifically to their own
unit_id.
2. Task Schema
A new Task collection is required. It includes fields for submission links and a verification loop.
const taskSchema = new mongoose.Schema({
title: { type: String, required: true },
description: { type: String, required: true },
assigned_by: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User',
required: true
},
assignees: [{
type: mongoose.Schema.Types.ObjectId,
ref: 'User',
required: true
}],
unit_id: {
type: mongoose.Schema.Types.ObjectId,
ref: 'Organizational_Unit'
},
deadline: { type: Date, required: true },
priority: {
type: String,
enum: ['low', 'medium', 'high'],
default: 'medium'
},
status: {
type: String,
enum: ['pending', 'in-progress', 'under-review', 'completed'],
default: 'pending'
},
submission_note: { type: String, default: "" }, // Link to work (Drive/Doc) or description
admin_notes: { type: String, default: "" }, // Feedback from the assigner
created_at: { type: Date, default: Date.now },
updated_at: { type: Date, default: Date.now }
});3. The "Two-Step" Verification Workflow
To ensure quality control, the status updates are split between the Assignee and the Assigner:
-
Student/ (Assignee) Permissions:
- Can move task from
pending→in-progress. - Can move task from
in-progress→under-review(Must provide asubmission_link). - Cannot mark a task as
completed.
- Can move task from
-
Head (Assigner) Permissions:
- Reviews tasks in the
under-reviewstate. - Can move task to
completed(closes the task). - Can move task back to
in-progressif the work is unsatisfactory (withadmin_notes).
- Reviews tasks in the
4. Technical Requirements
- MVC Pattern: All logic must be placed in
controllers/taskController.js. Route files should only handle the endpoint definition and middleware. - Backend Validation: The
POST /api/tasksendpoint must verify that theassigned_byuser has the authority to assign to the chosenassigneesbased on the hierarchy rules. - Frontend UI:
- Heads: Need a "Task Creator" modal and a "Progress Monitor" dashboard to see the status of all tasks they've assigned.
- Students/All role expect President Need a "My Tasks" card on their dashboard to update their progress and submit work.
Acceptance Criteria (Task Checklist)
-
TaskSchema implemented in the backend. - Controller logic created for
createTask,updateTaskStatus, andgetTaskStats. - Hierarchical filtering implemented: Assigner only sees valid assignees in the dropdown.
- Verification logic: Only the assigner can move a task to
completed. - Frontend "Task Tracker" UI added to the Student Profile.
- Frontend "Delegated Tasks" UI added to the Admin Profile/Dashboard.
Reactions are currently unavailable