detjonmataj/cpp-contester-php

#Backend: Implement test cases CRUD on API and Front

Closed this issue · 0 comments

We have to define some routes for this resource for both the API and the frontend.

On the frontend, we should implement some methods for rendering view, update and create pages.

On the API we should implement test cases CRUD as follows:

  • GET /test_cases 200 OK- will get all test cases
    • for now the filtering will be done through query params
      • GET/test_cases?key=value
      • if key is invalid return 400 bad request.
      • if value not found 404 error
  • POST /test_cases/create 201 Created - will create a test case based on the JSON payload
  • PUT /test_cases/update 200 OK - update the whole properties of test case
  • DELETE /test_cases/delete - delete the test case

All operations must be performed using primary key besides GET which can filter by anything.

Also this endpoint should be /api/test_cases. If there is any error we should return a JSON {"error": "message"}.