Move API endpoints under /api/configure/content/ to /api/content/

Pull out /api/configure/content API endpoints into /api/content to
allow for more logical organization of API path hierarchy

This should make the url more succinct and API request intent more
understandable by using existing HTTP method semantics along with the
path.

The /configure URL path segment was either
- redundant (e.g POST /configure/notion) or
- incorrect (e.g GET /configure/files)

Some example of naming improvements:
- GET /configure/types -> GET /content/types
- GET /configure/files -> GET /content/files
- DELETE /configure/files -> DELETE /content/files

This should also align, merge better the the content indexing API
triggered via PUT, PATCH /content

Refactor Flow
1. Rename /api/configure/types -> /api/content/types
2. Rename /api/configure -> /api
3. Move /api/content to api_content from under api_config
This commit is contained in:
Debanjum Singh Solanky
2024-07-19 00:00:49 +05:30
parent bba4e0b529
commit 469a1cb6a2
11 changed files with 331 additions and 340 deletions

View File

@@ -269,11 +269,11 @@ def test_get_api_config_types(client, sample_org_data, default_user: KhojUser):
text_search.setup(OrgToEntries, sample_org_data, regenerate=False, user=default_user)
# Act
response = client.get(f"/api/configure/types", headers=headers)
response = client.get(f"/api/content/types", headers=headers)
# Assert
assert response.status_code == 200
assert response.json() == ["all", "org", "plaintext"]
assert set(response.json()) == {"all", "org", "plaintext"}
# ----------------------------------------------------------------------------------------------------
@@ -289,7 +289,7 @@ def test_get_configured_types_with_no_content_config(fastapi_app: FastAPI):
client = TestClient(fastapi_app)
# Act
response = client.get(f"/api/configure/types")
response = client.get(f"/api/content/types")
# Assert
assert response.status_code == 200