-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor:restructure project architecture
Reorganized application package structure to improve modularity and navigability. Moved files from `fbr` to `app` directory and renamed key modules to better reflect functionality, such as `celery_worker`. Additionally, updated all relevant imports and settings configurations to align with the new structure, including Django settings and task management.
- Loading branch information
1 parent
eb344b3
commit df980bb
Showing
68 changed files
with
742 additions
and
454 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
web: bash paas_entrypoint.sh | ||
celery-worker: celery --app fbr.config.celery worker --task-events --loglevel INFO | ||
celery-beat: celery --app fbr.config.celery beat --loglevel INFO | ||
celery-worker: celery --app fbr.celery_app worker --task-events --loglevel INFO | ||
celery-beat: celery --app fbr.celery_app beat --loglevel INFO | ||
check: python manage.py check |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import logging | ||
|
||
from django.conf import settings | ||
from django.http import HttpRequest, HttpResponse | ||
from django.shortcuts import render | ||
from django.views.decorators.http import require_http_methods | ||
|
||
from app.search.config import SearchDocumentConfig | ||
from app.search.utils.search import search, search_database | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
@require_http_methods(["GET"]) | ||
def document(request: HttpRequest, id) -> HttpResponse: | ||
""" | ||
Document details view. | ||
Handles the GET request to fetch details based on the provided id. | ||
""" | ||
context = { | ||
"service_name": settings.SERVICE_NAME_SEARCH, | ||
} | ||
|
||
if not id: | ||
context["error"] = "id parameter is required" | ||
return render(request, template_name="document.html", context=context) | ||
|
||
# Create a search configuration object with the provided id | ||
config = SearchDocumentConfig(search_query="", id=id) | ||
|
||
try: | ||
queryset = search_database(config) | ||
context["result"] = queryset | ||
except Exception as e: | ||
logger.error("error fetching details: %s", e) | ||
context["error"] = f"error fetching details: {e}" | ||
|
||
return render(request, template_name="document.html", context=context) | ||
|
||
|
||
@require_http_methods(["GET"]) | ||
def search_django(request: HttpRequest): | ||
""" | ||
Search view. | ||
Renders the Django based search page. | ||
""" | ||
context = { | ||
"service_name": settings.SERVICE_NAME_SEARCH, | ||
} | ||
|
||
context = search(context, request) | ||
return render(request, template_name="django-fbr.html", context=context) | ||
|
||
|
||
@require_http_methods(["GET"]) | ||
def search_react(request: HttpRequest) -> HttpResponse: | ||
""" | ||
Search view. | ||
Renders the React based search page. | ||
""" | ||
|
||
context = { | ||
"service_name": settings.SERVICE_NAME_SEARCH, | ||
"document_types": { | ||
"standard": "Standard", | ||
"guidance": "Guidance", | ||
"legislation": "Legislation", | ||
}, | ||
} | ||
|
||
return render(request, template_name="react-fbr.html", context=context) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
from __future__ import absolute_import, unicode_literals | ||
|
||
# This ensures the app is always imported when Django starts | ||
# allowing shared_task to utilize this app. | ||
from .config.celery import celery_app | ||
from .celery_app import celery_app | ||
|
||
__all__ = ("celery_app",) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.