TaskModel - IEEE-Team-3/map GitHub Wiki
The task model is used to manage and store tasks assigned to users. Each task can have various states, deadlines, and rewards.
-
id
: Unique task identifier -
title
: Task name or description -
assignedTo
: User ID(s) of the assignee(s) -
createdBy
: User ID of the creator -
teamId
: Team the task is assigned to -
status
: "pending", "in-progress", "completed", "approved" -
points
: Number of points assigned to the task -
deadline
: Due date and time -
bonusPoints
: Additional bonus points upon approval -
createdAt
: Task creation date -
updatedAt
: Last update date
const TaskSchema = new Schema({
title: String,
assignedTo: [{ type: Schema.Types.ObjectId, ref: 'User' }],
createdBy: { type: Schema.Types.ObjectId, ref: 'User' },
teamId: { type: Schema.Types.ObjectId, ref: 'Team' },
status: { type: String, enum: ['pending', 'in-progress', 'completed', 'approved'], default: 'pending' },
points: { type: Number, required: true },
bonusPoints: { type: Number, default: 0 },
deadline: Date,
createdAt: { type: Date, default: Date.now },
updatedAt: { type: Date, default: Date.now }
});