Code Review!#15
Conversation
Development
Get/myteam
POST /events routes
Feat rsvp
delete rsvp route
patch route to update event
inlcuded "user" in GET/events route
included user to GET/event/:eventId
database with more development data
Release: version 0.1
Release: version 0.1.1
removed seed command in case of duplicates
matiasgarcia91
left a comment
There was a problem hiding this comment.
Backend looks tidy Juri, not much to say, good job!
|
|
||
| app.use("/events", eventRouter); | ||
|
|
||
| app.use("/teams", teamRouter); |
There was a problem hiding this comment.
This is a small recommendation. If you're going to attach a router directly to / route, then put it as the last one. The reason for this is that if by any chance you have a route like /:id in the auth router, it will catch all the requests sent to other routers because its basically /anything
| // }); | ||
| // comment.hasMany(models.event, { | ||
| // foreignKey: "eventId", | ||
| // }); |
There was a problem hiding this comment.
whats up with this? didn't work?
| const events = await Event.findAndCountAll({ | ||
| limit, | ||
| offset, | ||
| include: ["attending", "user"], |
There was a problem hiding this comment.
this works? i normally do it like:
include: [{ model: User, as "attending" }]
There was a problem hiding this comment.
it works as it is including all users attending (through rsvp model) and the user who created the event.
i had to try a lot of thing but this worked.
| if (!rsvp[1]) { | ||
| return res | ||
| .status(400) | ||
| .send({ message: "User is already attending this event" }); |
There was a problem hiding this comment.
nice backend safeguard
No description provided.