Skip to content

Commit

Permalink
Offer Model Change
Browse files Browse the repository at this point in the history
  • Loading branch information
aggmoulik committed Jul 20, 2020
1 parent 06ed39a commit 3fb0adf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 5 additions & 4 deletions controllers/OfferController.js
Expand Up @@ -3,10 +3,11 @@ const Response = require('../shared/Response'),

module.exports.addOffer = (req, res) => {
const offer = new Offer(req.body);
let start_date = new Date();
let end_date = new Date().setMinutes(start_date.getMinutes() + 10);
offer.start_date = start_date;
offer.end_date = end_date;
// let [date, month, year] = req.body.start_date.split('/');
// let start_date = new Date(date);
// let end_date = new Date().setMinutes(start_date.getMinutes() + 10);
// offer.start_date = start_date;
// offer.end_date = end_date;

offer.save((err, data) => {
Response.generalPayloadResponse(err, data, res);
Expand Down
5 changes: 4 additions & 1 deletion models/offerModel.js
Expand Up @@ -7,7 +7,10 @@ let offerSchema = new Schema({
description: String,
type: String,
discount: Number,
status: Number,
status: {
type: Number,
default: 1
},
start_date: Date,
end_date: Date,
});
Expand Down

0 comments on commit 3fb0adf

Please sign in to comment.