Skip to content

Events controller #23

@dscwebdev

Description

@dscwebdev

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

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

Get all events

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

Things expected from the req.query object:

  • [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 fields except registrants (Including the virtual field registrantCount)

Get events by ID

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

Things expected from the request body:

  • Nothing

Things to return:

  • All event's fields except registrants (Including the virtual field registrantCount)

Create event

POST: {{server_url}}/api/admin/events

Things expected from the request body:

  • All event's fields, refer to schema for what is required/what is not [You don't need to deal with validation, the schema should take care of it]

Things to return:

  • Newly created event's id

Patch event by ID

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

Things expected from the request body:

  • Any of event's fields except registrants

Things to return:

  • 200OK
  • The newly updated event, not including registrants

Delete event by ID

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

Things expected from the request body:

  • Nothing

Things to return:

  • 200OK

Metadata

Metadata

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