Skip to content

Area of Interest Table CRUD Routes and routes to support Area of Interest Intermediary Tables #26

@dlacuata

Description

@dlacuata

Description

The task is to create CRUD (Create, Read, Update, Delete) API routes for the Area of Interest table and implement endpoints for managing the many-to-many relationships through the relevant join tables.

Area of Interest table

  • POST /areas-of-interest - create an area of interest
  • GET /areas-of-interest - get all areas of interest
  • GET /areas-of-interest/{id} - get a single area of interest
  • PUT /areas-of-interest/{id} - update a single area of interest
  • DELETE /areas-of-interest/{id} - delete a single area of interest

Clinic-AreaOfInterest relationship

  • POST /clinics/{clinicId}/areas-of-interest - assign an area to a clinic
  • DELETE /clinics/{clinicId}/areas-of-interest/{areaId} - remove an area from a clinic
  • GET /clinics/{clinicId}/areas-of-interest - list all areas for a clinic

Workshop-AreaOfInterest relationship

  • POST /workshops/{workshopId}/areas-of-interest - assign an area to a workshop
  • DELETE /workshops/{workshopId}/areas-of-interest/{areaId} - remove an area from a workshop
  • GET /workshops/{workshopId}/areas-of-interest - list all areas for a workshop

Case-AreaOfInterest relationship

  • POST /cases/{caseId}/areas-of-interest - assign an area to a case
  • DELETE /cases/{caseId}/areas-of-interest/{areaId} - remove an area from a case
  • GET /cases/{caseId}/areas-of-interest - list all areas for a case

Recommended Steps

  • Git pull to fetch current changes and create a new branch.
  • Review the Area of Interest table schema and all relevant join tables.
  • Create areasOfInterest.js file in /server/routes.
  • Create workshops.js and case.js files in /server/routes for the intermediary table routes
  • Implement CRUD routes for the Area of Interest table.
  • Implement nested routes for managing Area of Interest relationships with Clinic, Workshop, and Case.
  • Add validation and error handling for all routes.
  • Test all routes using Postman and take screenshots as proof of functionality.

Acceptance Criteria

  • GET routes return all areas of interest or a single record by ID.
  • POST route creates a new area of interest.
  • PUT route updates an existing area of interest.
  • DELETE route removes an area of interest.
  • POST/DELETE/GET routes manage Clinic-AreaOfInterest, Workshop-AreaOfInterest, and Case-AreaOfInterest relationships correctly.
  • Error handling is implemented for all routes.

Resources

  • See users.ts or similar route files for structure reference.
  • Postman for testing requests.

If you have any questions, feel free to reach out to Josh or Dommenick on Slack!

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions