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

Registrants controller #24

Open
dscwebdev opened this issue Dec 9, 2024 · 0 comments
Open

Registrants controller #24

dscwebdev opened this issue Dec 9, 2024 · 0 comments
Assignees

Comments

@dscwebdev
Copy link
Collaborator

Postman Doc: https://drive.google.com/file/d/1f8CN7oUe0EsPWoTWN_23TpPaxWFZjivi/view?usp=drive_link

We will have a "new" resource called registrants, so we would want to make a REST API for it. There are 5 routes that will allow us to interact with this resource with admin perms, they are the following:

Get all registrants

GET: {{server_url}}/api/admin/events/{{event_id}}/registrants

Things expected from the request body:

  • Nothing

Things to return:

  • All registrants from event with {{event_id}}, each registrant is populated with the referenced user model in the userId field. (You should be able to just use .populate())

Get registrants by ID

GET: {{server_url}}/api/admin/events/{{event_id}}/registrants//{{user_id}}

Things expected from the request body:

  • Nothing

Things to return:

  • Registrants with {{user_id}} from event with {{event_id}}, the registrant is populated with the referenced user model in the userId field. (You should be able to just use .populate())

Attach registrant by ID

POST: {{server_url}}/api/admin/events/{{event_id}}/registrants//{{user_id}}

Things expected from the request body:

  • [Required] userId : ObjectID
    • The user must exist within our users collection, but also must not already be a registrant for this event (Maybe make a validator ?)
  • [Required] All keys in additionalFieldsSchema field of the event to attach to
    • For now, all values should be casted to string

Things to return:

  • 200OK
  • The newly attached registrant, populated with the user referenced

Patch event by ID

PATCH: {{server_url}}/api/admin/events/{{event_id}}/registrants//{{user_id}}

Things expected from the request body:

  • Any field within the additionalFieldsSchema

Things to return:

  • 200OK
  • Newly updated registrant, populated with user

Delete event by ID

DELETE: {{server_url}}/api/admin/events/{{event_id}}/registrants//{{user_id}}

Things expected from the request body:

  • Nothing

Things to return:

  • 200OK
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

No branches or pull requests

2 participants