skfarhad / hazard_reporting_system

BSD 3-Clause "New" or "Revised" License
15 stars 17 forks source link

Update Project with Docker Database Transfer, New APIs, Test Cases, and Swagger Integration #6

Closed TasfiqulGhani closed 3 weeks ago

TasfiqulGhani commented 3 weeks ago

Description:

This PR includes several significant updates to the project:

  1. Database Transfer:

    • Transferred the database from the local machine to the Docker environment.
    • Updated Docker setup to ensure smooth migration and setup of the database within Docker.
  2. New APIs Added:

    • Incident API:
      • Endpoint: /api/incidents/
      • Method: POST
      • Description: Allows providers to create new incidents. Requires API key for authentication.
      • Swagger Documentation: Added detailed descriptions and request/response schemas.
    • Volunteer API:
      • Endpoint: /api/volunteers/
      • Method: GET
      • Description: Provides a list of active volunteers. No authentication required.
      • Swagger Documentation: Added API documentation for easy reference.
  3. Test Cases:

    • Added comprehensive test cases for the new APIs:
      • Incident API Tests: Valid and invalid request scenarios.
      • Volunteer API Tests: Checks for correct data retrieval and handling.
  4. Swagger Integration:

    • Integrated Swagger for API documentation using drf_yasg.
    • Added schema views for both Swagger UI and ReDoc documentation.
    • Provided detailed API documentation for both Incident and Volunteer APIs, including request parameters, response schemas, and error codes.

Additional Changes:

Testing Instructions:

  1. Setup and Migration:

    • Build and start Docker containers: docker-compose up --build
    • Open Poetry shell: docker-compose exec be poetry shell
    • Run database migrations: python manage.py migrate
    • Create a superuser: python manage.py createsuperuser
  2. Testing:

    • Run test cases: docker-compose exec be poetry run python manage.py test
  3. API Documentation: