Skip to content

Commit

Permalink
Merge pull request #90 from manipalutsav/feature-registration-enabled
Browse files Browse the repository at this point in the history
Added event registration start and end date
  • Loading branch information
manipalutsav-svc authored Feb 29, 2024
2 parents 89f022d + e3a9ab2 commit 3e0294a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
19 changes: 16 additions & 3 deletions src/controllers/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,8 @@ const get = async (req, res, next) => {
endDate: event.endDate,
slottable: event.slottable,
faculty: event.faculty,
registrationStartDate: event.registrationStartDate,
registrationEndDate: event.registrationEndDate,
},
});
};
Expand Down Expand Up @@ -872,6 +874,8 @@ const getAll = async (req, res) => {
endDate: event.endDate,
slottable: event.slottable,
faculty: event.faculty,
registrationStartDate: event.registrationStartDate,
registrationEndDate: event.registrationEndDate,
};
});

Expand Down Expand Up @@ -1289,7 +1293,10 @@ const create = async (req, res) => {
startDate,
endDate,
slottable,
faculty } = req.body;
faculty,
registrationStartDate,
registrationEndDate,
} = req.body;

let event = new EventModel({
name,
Expand All @@ -1304,7 +1311,9 @@ const create = async (req, res) => {
startDate,
endDate,
slottable,
faculty
faculty,
registrationStartDate,
registrationEndDate,
});

await event.save().
Expand Down Expand Up @@ -1347,7 +1356,9 @@ const edit = async (req, res) => {
endDate,
slottable,
// criteria,
faculty
faculty,
registrationStartDate,
registrationEndDate,
} = req.body;

let event = await EventModel.findById(req.params.event);
Expand All @@ -1365,6 +1376,8 @@ const edit = async (req, res) => {
event.endDate = endDate ? endDate : event.endDate;
event.slottable = !!slottable;
event.faculty = faculty != undefined ? faculty : event.faculty;
event.registrationStartDate = registrationStartDate ? registrationStartDate : event.registrationStartDate;
event.registrationEndDate = registrationEndDate ? registrationEndDate : event.registrationEndDate;

//Seems like not required
// if (criteria) {
Expand Down
4 changes: 3 additions & 1 deletion src/models/Event.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const mongoose = require("mongoose");

const schema = {
rounds: [ mongoose.Schema.Types.ObjectId ],
rounds: [mongoose.Schema.Types.ObjectId],
name: {
type: String,
required: true,
Expand All @@ -27,6 +27,8 @@ const schema = {
required: true,
default: false,
},
registrationStartDate: Date,
registrationEndDate: Date
};

const options = {
Expand Down

0 comments on commit 3e0294a

Please sign in to comment.