-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(route): group leave event route #130
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll test them ASAP
//searching for the event in the list of the events already joined | ||
let found = false; | ||
let index: number; | ||
|
||
for(let e of group.events) { | ||
if (e === eventToLeave){ | ||
found = true; | ||
index = group.events.indexOf(e); | ||
break; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use array.indexOf instead, it will be more clear
import { HandlerDefinition } from '../../../../types/typing'; | ||
|
||
const schema: HandlerDefinition = { | ||
path: '/groups/event/leave', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
events
instead of event
properties: { | ||
groupId: { type: 'string' }, | ||
eventId: { type: 'string' }, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We talked about it few days ago but now i do think it's better to do a path like this
/groups/{groupId}/events/{eventId}/leave
, it's way more clear when we read the path of the route to undestand what it does !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better because the path of a route need to defineds an entity, for example :
/musicians
defines all the musicians/musicians/{musicianId}
defines one musician
so it is clear than /groups/{groupId}/events/{eventId}/leave
defines the fact that the group groupId
want to leave the event eventId
router.post('/event/join', groupController.groupJoinEvent); | ||
router.delete('/event/delete', groupController.groupLeaveEvent); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, events
instead of event
Not tested yet, will do later. @RomainGuarinoni if you want test it in the mean time