Skip to content

Commit

Permalink
did nec changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sridhar-5 committed Feb 12, 2022
1 parent a5ba002 commit 458893d
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 62 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ app.use("/api/login", LoginUser);
app.use("/api/register", RegisterUser);
app.use("/api/all-events", allEvent);
app.use("/api/admin-users-portal", AdminUsersEndpoint);
app.use("/api/category-events", ClubEvents);
app.use("/api/category-events", CategoryEvents);

//Homepage Endpoint
app.get("/", (request, response) => {
Expand Down
2 changes: 1 addition & 1 deletion models/Events.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const Joi = require("joi");
const mongoose = require("mongoose");

const EventSchema = mongoose.Schema({
Expand Down Expand Up @@ -29,6 +28,7 @@ const EventSchema = mongoose.Schema({
},
StarCount: {
type: Number,
default: 0,
},
Category: {
type: String,
Expand Down
1 change: 0 additions & 1 deletion models/Users.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const Joi = require("joi");
const mongoose = require("mongoose");
const jwt = require("jsonwebtoken");
require("dotenv").config();
Expand Down
98 changes: 67 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"express": "^4.17.1",
"jsonwebtoken": "^8.5.1",
"lodash": "^4.17.21",
"mongoose": "^5.13.5"
"mongoose": "^5.13.14"
},
"devDependencies": {
"nodemon": "^2.0.12"
Expand Down
31 changes: 4 additions & 27 deletions routes/AdminUsersEndpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const _ = require("lodash");
const AuthenticateUser = require("../middleware/AuthenticateUser");
const CheckAdminUser = require("../middleware/AuthAdminUser");
const { Events } = require("../models/Events");
const { Club } = require("../models/club");

router.get(
"/",
Expand All @@ -15,7 +14,7 @@ router.get(
var SelectedAttributedForCardView = [];
AllEvents.forEach((event) => {
SelectedAttributedForCardView.push(
_.pick(event, ["_id", "ImageUrl", "Title", "OrganizingClub", "Date"])
_.pick(event, ["_id", "ImageUrl", "Title", "Category", "Date"])
);
});
return response.status(200).send(SelectedAttributedForCardView);
Expand Down Expand Up @@ -46,14 +45,11 @@ router.post(
const event = new Events({
ImageUrl: request.body.ImageUrl,
Title: request.body.Title,
Caption: request.body.Caption,
Description: request.body.Description,
OrganizingClub: request.body.OrganizingClub,
Date: request.body.Date,
Venue: request.body.Venue,
Category: request.body.OrganizingClub,
location: request.body.Venue,
RegistrationLink: request.body.RegistrationLink,
Note: request.body.Note,
ContactDetails: request.body.ContactDetails,
Prerequisites: request.body.Prerequisites,
});

const StatusSave = await event.save();
Expand All @@ -79,25 +75,6 @@ router.delete(
}
);

//creating a new club

router.post(
"/createClub",
[AuthenticateUser, CheckAdminUser],
async (request, response) => {
const NewClub = new Club({
ClubImageUrl: request.body.ClubImageUrl,
ClubName: request.body.ClubName,
ClubDescription: request.body.ClubDescription,
InstaHandle: request.body.InstaHandle,
});

const StatusSave = await NewClub.save();

response.status(200).send(NewClub);
}
);

router.put(
"/:id",
[AuthenticateUser, CheckAdminUser],
Expand Down

0 comments on commit 458893d

Please sign in to comment.