Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AlexisAoun
Copy link
Contributor

Not tested yet, will do later. @RomainGuarinoni if you want test it in the mean time

@AlexisAoun AlexisAoun linked an issue Mar 22, 2022 that may be closed by this pull request
Copy link
Collaborator

@RomainGuarinoni RomainGuarinoni left a 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

Comment on lines +72 to +82
//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;
}
}
Copy link
Collaborator

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',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

events instead of event

Comment on lines +16 to +19
properties: {
groupId: { type: 'string' },
eventId: { type: 'string' },
},
Copy link
Collaborator

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 !

Copy link
Collaborator

@RomainGuarinoni RomainGuarinoni Mar 22, 2022

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

Comment on lines 13 to +14
router.post('/event/join', groupController.groupJoinEvent);
router.delete('/event/delete', groupController.groupLeaveEvent);
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a route for a group leaving an event
2 participants