Skip to content

Fix response model for DELETE /group endpoint #427

@JenySadadia

Description

@JenySadadia

Related to #321

API endpoint DELETE /group/<group-id> is implemented for deleting user groups matching provided group ID.

The handler delete_group has a pagination response model PageModel even if the endpoint is not returning anything. This adjustment was required to use DB method db.find_by_attributes method in the handler to get the required information before deleting the group. As the DB method is returning paginated response, I needed to declare response_model=PageModel in the handler to use it as per fastapi-pagination package requirements. Please see the comment for more details on the issue.

This can be fixed by using pagination_ctx from fastapi-pagination package that was introduced in version 0.12.0 as mentioned in uriyyo/fastapi-pagination#590. However, it requires fastapi>=0.80.0 version to use it.

Below is the error log when I tried to install fastapi-pagination 0.12.0:

ERROR: Cannot install -r docker/api/requirements.txt (line 4) and fastapi[all]==0.68.1 because these package versions have conflicting dependencies.

The conflict is caused by:
    fastapi[all] 0.68.1 depends on fastapi 0.68.1 (from https://files.pythonhosted.org/packages/df/44/ee1976b03404318590bbe4b0ef27007ce2c42b15757aa0c72bc99a4ebae7/fastapi-0.68.1-py3-none-any.whl#sha256=94d2820906c36b9b8303796fb7271337ec89c74223229e3cfcf056b5a7d59e23 (from https://pypi.org/simple/fastapi/) (requires-python:>=3.6))
    fastapi-pagination 0.12.0 depends on fastapi>=0.80.0

Checklist to complete the issue:

  • Upgrade fastapi
  • Upgrade fastapi-pagination
  • Fix delete_group handler
  • Test on staging

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