Skip to content

Unify configuration endpoints in English app#283

Merged
2-Coatl merged 1 commit intodevelopfrom
feature/find-difference-between-configuracion-and-configuration-06-49-20
Nov 20, 2025
Merged

Unify configuration endpoints in English app#283
2-Coatl merged 1 commit intodevelopfrom
feature/find-difference-between-configuracion-and-configuration-06-49-20

Conversation

@2-Coatl
Copy link
Collaborator

@2-Coatl 2-Coatl commented Nov 20, 2025

Summary

  • remove the legacy Spanish configuracion app and keep the English configuration module as the single implementation
  • add detail, historial, and auditoria endpoints to the configuration service/views while keeping Spanish route names
  • add unit tests to ensure the legacy Spanish paths are served by the English implementation

Testing

  • pytest tests/unit/configuration/test_views_historial.py (fails: missing Django dependency in the environment)

Codex Task

Copilot AI review requested due to automatic review settings November 20, 2025 06:49
@2-Coatl 2-Coatl merged commit 0e03570 into develop Nov 20, 2025
13 of 53 checks passed
@2-Coatl 2-Coatl deleted the feature/find-difference-between-configuracion-and-configuration-06-49-20 branch November 20, 2025 06:52
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR consolidates the configuration management endpoints by removing the legacy Spanish configuracion app and unifying all functionality under the English configuration app. The Spanish routes (/api/v1/configuracion/) now point to the English implementation via URL namespacing.

Key changes:

  • Adds GET endpoints for configuration detail, history, and audit trail to the configuration views
  • Routes Spanish paths to English implementation using Django URL namespacing
  • Removes entire configuracion app (models, views, services, serializers, URLs, migrations)
  • Adds comprehensive unit tests validating the consolidation and new endpoints

Reviewed Changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
api/callcentersite/callcentersite/urls.py Adds Spanish route alias pointing to English configuration implementation with namespace
api/callcentersite/callcentersite/settings/base.py Removes legacy configuracion app from INSTALLED_APPS
api/callcentersite/callcentersite/apps/configuration/views.py Adds GET method to ConfiguracionEditarView for detail retrieval; adds ConfiguracionHistorialView and ConfiguracionAuditoriaView
api/callcentersite/callcentersite/apps/configuration/urls.py Adds URL patterns for historial and auditar endpoints
api/callcentersite/callcentersite/apps/configuration/services.py Adds obtener_configuracion_detalle, obtener_historial_configuracion, and obtener_historial_general service methods
api/callcentersite/tests/unit/configuration/test_views_historial.py New test file validating new view endpoints with mocked service calls
api/callcentersite/tests/unit/configuration/test_consolidation.py New test file ensuring Spanish routes resolve to English implementation
api/callcentersite/callcentersite/apps/configuracion/*.py Complete removal of legacy Spanish app files (views, services, serializers, models, URLs, migrations, config)

Comment on lines 19 to +23
path("<str:clave>/", ConfiguracionEditarView.as_view(), name="editar"),
path("<str:clave>/historial/", ConfiguracionHistorialView.as_view(), name="historial"),
path("exportar/", ConfiguracionExportarView.as_view(), name="exportar"),
path("importar/", ConfiguracionImportarView.as_view(), name="importar"),
path("auditar/", ConfiguracionAuditoriaView.as_view(), name="auditar"),
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

URL pattern ordering issue: The pattern path("<str:clave>/", ...) on line 19 will match any string, including "auditar" and "exportar". This means the auditar and exportar endpoints (lines 21, 23) will never be reached because Django will match them as clave values first.

Solution: Move the specific paths (exportar/, importar/, auditar/) before the generic <str:clave>/ pattern to ensure they match first:

urlpatterns = [
    path("", ConfiguracionListView.as_view(), name="list"),
    path("exportar/", ConfiguracionExportarView.as_view(), name="exportar"),
    path("importar/", ConfiguracionImportarView.as_view(), name="importar"),
    path("auditar/", ConfiguracionAuditoriaView.as_view(), name="auditar"),
    path("<str:clave>/", ConfiguracionEditarView.as_view(), name="editar"),
    path("<str:clave>/historial/", ConfiguracionHistorialView.as_view(), name="historial"),
    path("<str:clave>/restaurar/", ConfiguracionRestaurarView.as_view(), name="restaurar"),
]
Suggested change
path("<str:clave>/", ConfiguracionEditarView.as_view(), name="editar"),
path("<str:clave>/historial/", ConfiguracionHistorialView.as_view(), name="historial"),
path("exportar/", ConfiguracionExportarView.as_view(), name="exportar"),
path("importar/", ConfiguracionImportarView.as_view(), name="importar"),
path("auditar/", ConfiguracionAuditoriaView.as_view(), name="auditar"),
path("exportar/", ConfiguracionExportarView.as_view(), name="exportar"),
path("importar/", ConfiguracionImportarView.as_view(), name="importar"),
path("auditar/", ConfiguracionAuditoriaView.as_view(), name="auditar"),
path("<str:clave>/", ConfiguracionEditarView.as_view(), name="editar"),
path("<str:clave>/historial/", ConfiguracionHistorialView.as_view(), name="historial"),

Copilot uses AI. Check for mistakes.
return Response(
{'error': str(e)},
status=status.HTTP_403_FORBIDDEN,
)
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing ValidationError exception handling: The ConfiguracionAuditoriaView.get() method handles PermissionDenied but not ValidationError, unlike the other similar views in this file (e.g., ConfiguracionHistorialView on lines 229-232, ConfiguracionEditarView on lines 114-117). While obtener_historial_general may not currently raise ValidationError, consistent error handling across similar endpoints improves maintainability.

Suggestion: Add ValidationError handling for consistency:

except ValidationError as e:
    return Response(
        {'error': str(e)},
        status=status.HTTP_400_BAD_REQUEST,
    )
Suggested change
)
)
except ValidationError as e:
return Response(
{'error': str(e)},
status=status.HTTP_400_BAD_REQUEST,
)

Copilot uses AI. Check for mistakes.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants