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 any PositionHolder.
- 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 a submission_link).
- Cannot mark a task as
completed.
-
Head (Assigner) Permissions:
- Reviews tasks in the
under-review state.
- Can move task to
completed (closes the task).
- Can move task back to
in-progress if the work is unsatisfactory (with admin_notes).
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/tasks endpoint must verify that the assigned_by user has the authority to assign to the chosen assignees based 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)
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:
GENSEC_*,CLUB_COORDINATOR, or anyPositionHolder.'scitech'category.unit_id.2. Task Schema
A new
Taskcollection is required. It includes fields for submission links and a verification loop.3. The "Two-Step" Verification Workflow
To ensure quality control, the status updates are split between the Assignee and the Assigner:
Student/ (Assignee) Permissions:
pending→in-progress.in-progress→under-review(Must provide asubmission_link).completed.Head (Assigner) Permissions:
under-reviewstate.completed(closes the task).in-progressif the work is unsatisfactory (withadmin_notes).4. Technical Requirements
controllers/taskController.js. Route files should only handle the endpoint definition and middleware.POST /api/tasksendpoint must verify that theassigned_byuser has the authority to assign to the chosenassigneesbased on the hierarchy rules.Acceptance Criteria (Task Checklist)
TaskSchema implemented in the backend.createTask,updateTaskStatus, andgetTaskStats.completed.