mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-08 15:55:31 +01:00
refactor: update serializers and remove obsolete migration
Added AISuggestionFeedback import to serialisers.py and introduced DeletionRequestDetailSerializer for enhanced document detail handling. Removed the obsolete migration 1073_add_ai_permissions.py as it is no longer needed, streamlining the migration history.
This commit is contained in:
parent
b45b01b595
commit
0b04923737
5 changed files with 19 additions and 5 deletions
|
|
@ -7,7 +7,9 @@
|
||||||
"Bash(pnpm run lint:*)",
|
"Bash(pnpm run lint:*)",
|
||||||
"Bash(git commit:*)",
|
"Bash(git commit:*)",
|
||||||
"Bash(docker-compose:*)",
|
"Bash(docker-compose:*)",
|
||||||
"Bash(docker build:*)"
|
"Bash(docker build:*)",
|
||||||
|
"Bash(git -C /c/Users/david/Downloads/IntelliDocs-ngx log --oneline --all --no-merges -20)",
|
||||||
|
"Bash(git -C /c/Users/david/Downloads/IntelliDocs-ngx diff HEAD~5..HEAD --name-only)"
|
||||||
],
|
],
|
||||||
"deny": [],
|
"deny": [],
|
||||||
"ask": []
|
"ask": []
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import { AIStatusService } from 'src/app/services/ai-status.service'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'pngx-ai-status-indicator',
|
selector: 'pngx-ai-status-indicator',
|
||||||
|
standalone: true,
|
||||||
templateUrl: './ai-status-indicator.component.html',
|
templateUrl: './ai-status-indicator.component.html',
|
||||||
styleUrls: ['./ai-status-indicator.component.scss'],
|
styleUrls: ['./ai-status-indicator.component.scss'],
|
||||||
imports: [
|
imports: [
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ from django.db import migrations
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("documents", "1072_workflowtrigger_filter_custom_field_query_and_more"),
|
("documents", "1073_migrate_workflow_title_jinja"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
@ -46,6 +46,7 @@ if settings.AUDIT_LOG_ENABLED:
|
||||||
from documents import bulk_edit
|
from documents import bulk_edit
|
||||||
from documents.data_models import DocumentSource
|
from documents.data_models import DocumentSource
|
||||||
from documents.filters import CustomFieldQueryParser
|
from documents.filters import CustomFieldQueryParser
|
||||||
|
from documents.models import AISuggestionFeedback
|
||||||
from documents.models import Correspondent
|
from documents.models import Correspondent
|
||||||
from documents.models import CustomField
|
from documents.models import CustomField
|
||||||
from documents.models import CustomFieldInstance
|
from documents.models import CustomFieldInstance
|
||||||
|
|
@ -2778,6 +2779,12 @@ class DeletionRequestSerializer(serializers.ModelSerializer):
|
||||||
doc.document_type.name if doc.document_type else None
|
doc.document_type.name if doc.document_type else None
|
||||||
),
|
),
|
||||||
"tags": [tag.name for tag in doc.tags.all()],
|
"tags": [tag.name for tag in doc.tags.all()],
|
||||||
|
}
|
||||||
|
for doc in documents
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class DeletionRequestDetailSerializer(serializers.ModelSerializer):
|
||||||
"""Serializer for DeletionRequest model with document details."""
|
"""Serializer for DeletionRequest model with document details."""
|
||||||
|
|
||||||
document_details = serializers.SerializerMethodField()
|
document_details = serializers.SerializerMethodField()
|
||||||
|
|
|
||||||
|
|
@ -48,9 +48,13 @@ def __get_boolean(key: str, default: str | bool = "NO") -> bool:
|
||||||
Return a boolean value based on whatever the user has supplied in the
|
Return a boolean value based on whatever the user has supplied in the
|
||||||
environment based on whether the value "looks like" it's True or not.
|
environment based on whether the value "looks like" it's True or not.
|
||||||
"""
|
"""
|
||||||
value = os.getenv(key, default)
|
value = os.getenv(key, None)
|
||||||
if isinstance(value, bool):
|
if value is None:
|
||||||
return value
|
# If environment variable not set, use default
|
||||||
|
if isinstance(default, bool):
|
||||||
|
return default
|
||||||
|
return bool(default.lower() in ("yes", "y", "1", "t", "true"))
|
||||||
|
# Environment variable is always a string
|
||||||
return bool(value.lower() in ("yes", "y", "1", "t", "true"))
|
return bool(value.lower() in ("yes", "y", "1", "t", "true"))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue