Skip to content

Commit

Permalink
added priority, dueDate to task schema. add task modal input elements
Browse files Browse the repository at this point in the history
  • Loading branch information
kkashiva committed May 18, 2024
1 parent 2c0cb0a commit ee7a9ad
Show file tree
Hide file tree
Showing 3 changed files with 335 additions and 260 deletions.
4 changes: 2 additions & 2 deletions controllers/appController.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ module.exports.postEditSwimlane = async (req, res, next) => {

// Create a new task
module.exports.postNewTask = async (req, res, next) => {
const { boardId, title, description, status } = req.body;
const { boardId, title, description, status, priority, dueDate } = req.body;
try {
let user = await User.findById(req.user._id);
let board = user.boards.id(boardId);
Expand All @@ -130,7 +130,7 @@ module.exports.postNewTask = async (req, res, next) => {
}
let swimlaneID = board.swimlanes.id(status);
// board.swimlanes.push({ title });
swimlaneID.tasks.push({ title, description, creationDate: Date.now() });
swimlaneID.tasks.push({ title, description, creationDate: Date.now(), priority, dueDate});
user.totalTasks = Number(user.totalTasks) || 0;
user.totalTasks += 1;

Expand Down
8 changes: 8 additions & 0 deletions models/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ const taskSchema = new Schema({
type: Number,
default: 0,
},
// priority with values 'high' 'medium' 'low'
priority: {
type: String,
enum: ["high", "medium", "low"],},
// task deadline or due date
dueDate: {
type: Date,
},
});

// Swimlane schema
Expand Down
Loading

0 comments on commit ee7a9ad

Please sign in to comment.