diff --git a/src/authentication.py b/src/authentication.py index d5617c7..173b8be 100644 --- a/src/authentication.py +++ b/src/authentication.py @@ -1,6 +1,4 @@ from datetime import datetime, timedelta - -from fastapi import HTTPException from src.database import Users, Sessions, IntegrityError, DoesNotExist from src.helpers import string_in_range from src.error import InputError diff --git a/src/generation.py b/src/generation.py index f5f10b9..d4f6953 100644 --- a/src/generation.py +++ b/src/generation.py @@ -107,6 +107,7 @@ def generate_diagnostic_list(invoice_text: str) -> List[LintDiagnostic]: column=violation.column, xpath=violation.xpath, message=violation.message, + suggestion=None, severity="error" if violation.is_fatal else "warning" )) @@ -122,6 +123,7 @@ def generate_diagnostic_list(invoice_text: str) -> List[LintDiagnostic]: column=violation.column, xpath=violation.xpath, message=violation.message, + suggestion=None, severity="error" if violation.is_fatal else "warning" )) diff --git a/src/main.py b/src/main.py index 2dcc688..6fa1b46 100644 --- a/src/main.py +++ b/src/main.py @@ -1,4 +1,3 @@ -import signal from src.config import base_url, port from src.health_check import health_check_v1 from src.report import * @@ -7,9 +6,9 @@ from src.authentication import * from src.type_structure import * from src.database import clear_v1 -from fastapi import Depends, FastAPI, Request, HTTPException, Security, UploadFile, File +from fastapi import Depends, FastAPI, Request,UploadFile, File from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm -from fastapi.responses import Response, JSONResponse, HTMLResponse, StreamingResponse +from fastapi.responses import JSONResponse, HTMLResponse, StreamingResponse from fastapi.middleware.cors import CORSMiddleware from io import BytesIO import uvicorn diff --git a/src/report.py b/src/report.py index d997297..5e0a969 100644 --- a/src/report.py +++ b/src/report.py @@ -1,7 +1,6 @@ -from fastapi import HTTPException -from src.type_structure import * from typing import Dict -from src.database import Reports, Sessions, Users +from src.type_structure import * +from src.database import Reports, Sessions from src.generation import generate_xslt_evaluation, generate_schema_evaluation, generate_wellformedness_evaluation, generate_diagnostic_list from peewee import DoesNotExist from src.constants import ADMIN_TOKEN, PEPPOL_EXECUTABLE, SYNTAX_EXECUTABLE @@ -61,7 +60,7 @@ def report_change_name_v2(token: str, report_id: int, new_name: str) -> Dict[Non try: session = Sessions.get(token=token) except DoesNotExist: - raise ForbiddenError("Invalid token") + raise UnauthorisedError("Invalid token") if not report.owner == session.user: raise ForbiddenError("You do not have permission to rename this report") @@ -86,7 +85,7 @@ def report_delete_v2(token: str, report_id: int) -> Dict[None, None]: try: session = Sessions.get(token=token) except DoesNotExist: - raise ForbiddenError("Invalid token") + raise UnauthorisedError("Invalid token") if not report.owner == session.user: raise ForbiddenError("You do not have permission to delete this report")