Skip to content

User and admin routes refactoring #25

@dscwebdev

Description

@dscwebdev

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

Due to our new changes to the events structure, we will need to update a few endpoints to make sure they still function as usual.

Refactor Get QR endpoint

Old: GET: {{server_url}}/api/users/qr, which is getQR in the user controller
New: GET: {{server_url}}/api/users/qr/{{event_id}}

Things expected from the request body:

  • Nothing

Things to return:

  • userId: userId from token
  • secretName: hashed secret name from event with id {{event_id}}

Refactor Check In endpoint

Old: PATCH: {{server_url}}/api/admin/users/checkIn/{{user_id}}, which is checkInByID in the admin controller
New: PATCH: {{server_url}}/api/admin/users/checkIn/{{event_id}}/{{user_id}}

Things expected from the request body:

  • [Required] secretName : string
    • This string should not match the secretName of {{event_id}} directly, but is a hash of it. Use bycrypt.compare to check its validity.

Things to return:

  • 200OK

Get events

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

Things expected from the request body:

  • [Optional] fromDate : Datetime
    • This determines the oldest date a return event's startDate can be
  • [Optional] upToDate : Datetime
    • This determines the latest date a return event's startDate can be
  • [Caveat] When fromDate and upToDate are both not provided
    • Returns all events
  • [Caveat] When fromDate and upToDate are both exactly the same
    -Returns all events that have their interval overlap the date provided

Things to return:

  • All event's basic fields, DO NOT return sensitive fields (Sensitive fields include registrantCount)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions