event date add
@ -7,6 +7,7 @@ import { ResisterUserModel } from "../models/EventsModel.js"
|
||||
export const createEvent = async (req, res) => {
|
||||
|
||||
try {
|
||||
// console.log(req.body)
|
||||
const files = req.files.image;
|
||||
|
||||
// console.log(files)
|
||||
@ -14,7 +15,7 @@ export const createEvent = async (req, res) => {
|
||||
folder: "cmp/image",
|
||||
},
|
||||
function (error, result) { (result, error) });
|
||||
const { title, location, description } = req.body;
|
||||
const { title, location, description, date, time } = req.body;
|
||||
|
||||
const data = await Events.create({
|
||||
title,
|
||||
@ -24,6 +25,8 @@ export const createEvent = async (req, res) => {
|
||||
},
|
||||
location,
|
||||
description,
|
||||
date,
|
||||
time,
|
||||
addedBy: req.user.id
|
||||
|
||||
});
|
||||
@ -33,6 +36,7 @@ export const createEvent = async (req, res) => {
|
||||
data,
|
||||
});
|
||||
} catch (error) {
|
||||
// console.log(error)
|
||||
res.status(500).json({
|
||||
success: false,
|
||||
msg: "Failled to create Event !!"
|
||||
@ -87,6 +91,8 @@ export const updateEvent = async (req, res) => {
|
||||
title: req.body.title,
|
||||
description: req.body.description,
|
||||
location: req.body.location,
|
||||
date: req.body.date,
|
||||
time: req.body.time,
|
||||
};
|
||||
|
||||
|
||||
|
@ -16,6 +16,14 @@ const eventSchema = new mongoose.Schema(
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
date: {
|
||||
type: Date,
|
||||
required: true
|
||||
},
|
||||
time: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
location: {
|
||||
type: String,
|
||||
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 |