event date add
@ -7,6 +7,7 @@ import { ResisterUserModel } from "../models/EventsModel.js"
|
|||||||
export const createEvent = async (req, res) => {
|
export const createEvent = async (req, res) => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// console.log(req.body)
|
||||||
const files = req.files.image;
|
const files = req.files.image;
|
||||||
|
|
||||||
// console.log(files)
|
// console.log(files)
|
||||||
@ -14,7 +15,7 @@ export const createEvent = async (req, res) => {
|
|||||||
folder: "cmp/image",
|
folder: "cmp/image",
|
||||||
},
|
},
|
||||||
function (error, result) { (result, error) });
|
function (error, result) { (result, error) });
|
||||||
const { title, location, description } = req.body;
|
const { title, location, description, date, time } = req.body;
|
||||||
|
|
||||||
const data = await Events.create({
|
const data = await Events.create({
|
||||||
title,
|
title,
|
||||||
@ -24,6 +25,8 @@ export const createEvent = async (req, res) => {
|
|||||||
},
|
},
|
||||||
location,
|
location,
|
||||||
description,
|
description,
|
||||||
|
date,
|
||||||
|
time,
|
||||||
addedBy: req.user.id
|
addedBy: req.user.id
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -33,6 +36,7 @@ export const createEvent = async (req, res) => {
|
|||||||
data,
|
data,
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
// console.log(error)
|
||||||
res.status(500).json({
|
res.status(500).json({
|
||||||
success: false,
|
success: false,
|
||||||
msg: "Failled to create Event !!"
|
msg: "Failled to create Event !!"
|
||||||
@ -87,6 +91,8 @@ export const updateEvent = async (req, res) => {
|
|||||||
title: req.body.title,
|
title: req.body.title,
|
||||||
description: req.body.description,
|
description: req.body.description,
|
||||||
location: req.body.location,
|
location: req.body.location,
|
||||||
|
date: req.body.date,
|
||||||
|
time: req.body.time,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,6 +16,14 @@ const eventSchema = new mongoose.Schema(
|
|||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
date: {
|
||||||
|
type: Date,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
time: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
location: {
|
location: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true
|
required: true
|
||||||
|
BIN
tmp/tmp-1-1658315722170
Normal file
After Width: | Height: | Size: 1.4 MiB |
BIN
tmp/tmp-1-1658315928606
Normal file
After Width: | Height: | Size: 620 KiB |
BIN
tmp/tmp-1-1658316073587
Normal file
After Width: | Height: | Size: 620 KiB |
BIN
tmp/tmp-1-1658316799355
Normal file
After Width: | Height: | Size: 1.4 MiB |
BIN
tmp/tmp-2-1658315741266
Normal file
After Width: | Height: | Size: 1.4 MiB |
BIN
tmp/tmp-2-1658317830552
Normal file
After Width: | Height: | Size: 620 KiB |
BIN
tmp/tmp-3-1658315841998
Normal file
After Width: | Height: | Size: 620 KiB |