- Minor corrections to entitlement changes and upgrades

- started new eveai_entitlements component (not finished)
This commit is contained in:
Josako
2024-10-08 09:12:16 +02:00
parent 9782e31ae5
commit d6a7743f26
12 changed files with 392 additions and 13 deletions

View File

@@ -12,6 +12,7 @@ import requests
from urllib.parse import urlparse, unquote
import os
from .eveai_exceptions import EveAIInvalidLanguageException, EveAIDoubleURLException, EveAIUnsupportedFileType
from ..models.user import Tenant
def create_document_stack(api_input, file, filename, extension, tenant_id):
@@ -81,6 +82,8 @@ def create_version_for_document(document, url, language, user_context, user_meta
set_logging_information(new_doc_vers, dt.now(tz.utc))
mark_tenant_storage_dirty(document.tenant_id)
return new_doc_vers
@@ -338,3 +341,10 @@ def refresh_document(doc_id):
}
return refresh_document_with_info(doc_id, api_input)
# Function triggered when a document_version is created or updated
def mark_tenant_storage_dirty(tenant_id):
tenant = db.session.query(Tenant).filter_by(id=tenant_id).first()
tenant.storage_dirty = True
db.session.commit()

View File

@@ -34,3 +34,10 @@ class EveAIUnsupportedFileType(EveAIException):
super().__init__(message, status_code, payload)
class EveAINoLicenseForTenant(EveAIException):
"""Raised when no active license for a tenant is provided"""
def __init__(self, message="No license for tenant found", status_code=400, payload=None):
super().__init__(message, status_code, payload)