Skip to content
Snippets Groups Projects

Web GUI Suche und alle API-Abfragen

Merged Pavlos Giannakis requested to merge feature/128-web-gui into main
  • Dieser MR enthaelt alle changes fuer die Suche #128 (closed) (hier im Ticket schauen, es sind nur 2 Sub Tasks abgehackt, der Rest kommt dann im naechsten Sprint)
  • Alle APIs sind fertig und dokumentiert: #38 (closed), #127 (closed), #51 (closed) und #45 (closed)
  • Tests gerade gezogen und neue hinzugefuegt
  • Die Pipeline laeuft nicht gruen, weil ruff wegen einer Datei meckert, wenn diese dann entsprechend ruff formatiert wird, dann meckert black :D lol
Edited by Pavlos Giannakis

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
11
12 from ..config import get_directories, create_engine_from_env
13
14 router = APIRouter()
15
16 directories = get_directories()
17 server_url = os.getenv("SERVER_URL")
18
19 templates = Jinja2Templates(directory=directories.templates)
20 router.mount(
21 "/static",
22 StaticFiles(directory=directories.static),
23 name="static",
24 )
25
26 engine = create_engine_from_env()
  • Das ist wieder dasselbe Problem wie vor 2 Wochen: Wenn die engine als globale Konstante aus der Environment erstellt wird, dann schlaegt pytest fehl, weil DATABASE_URL nicht gesetzt ist. Habe es bei mir ausgecheckt und validiert. Die engine muss wieder inenrhalb von create_app aufgerufen werden.

    Ausserdem: Warum gibt es in __init__.py, internal.py und v0.py eine Engineinstance? Dadurch koennen keine Connections geteilt werden.

    Was haeltst du davon, die Routen einfach wieder wie vorher in die main.py zu legen? Die erhoehte Komplexitaet durch das Auseinanderziehen rechtfertigt aus meiner Sicht nicht die gesparten Zeilen in der main.

  • Pavlos Giannakis changed this line in version 5 of the diff

    changed this line in version 5 of the diff

  • Please register or sign in to reply
  • 66 f"{server_url}/api/v0/schemas/id/{id}/version/{version}"
    67 )
    68 response.raise_for_status()
    69 schema = response.json()
    70
    71 return templates.TemplateResponse(
    72 "schema_detail.html",
    73 {
    74 "request": request,
    75 "schema": schema,
    76 },
    77 )
    78
    79
    80 # Fetches the schemas from the API based on the provided parameters
    81 async def _fetch_schemas(show_all: bool, page: int, size: int):
  • 10 9 class Database:
    11 10 def __init__(self, connection: Connection):
    12 11 self.connection = connection
    12 engine = self.connection.engine
  • 117 return jsonable_encoder(schema_dict)
    118
    119
    120 @router.get(
    121 "/schemas/status/{status}",
    122 response_class=JSONResponse,
    123 name="Get one or more schemas based on status",
    124 description="Get one or more schemas based on the status. Available status are: "
    125 "in Planung, in Bearbeitung,"
    126 "Entwurf, methodisch freigegeben, fachlich freigegeben (silber), fachlich "
    127 "freigegeben (gold), inaktiv.",
    128 responses={
    129 200: {"model": SchemaOut},
    130 },
    131 )
    132 def get_schemas_by_status(
  • 28 28
    29 29 op.drop_column("schema", "nachricht_id")
    30 30 op.drop_column("schema", "erstellungs_zeitpunkt")
    31 op.drop_column("schema", "status")
    31 32
    32 33
    33 34 def downgrade():
    34 35 op.add_column("schema", sa.Column("nachricht_id", sa.String(), default=None))
    36 op.add_column("schema", sa.Column("status", sa.String(), default=None))
    35 37 op.add_column(
    36 38 "schema", sa.Column("erstellungs_zeitpunkt", sa.TIMESTAMP(), default=None)
    37 39 )
    38 40
    39 op.drop_column("schema", "freigabestatus")
    • Die Migration ist schon deployed auf der Staging. Jetzt die downgrade-methode zu aendern wirft einen Fehler, weil die Column ``freigabe_status` unbekannt ist. Die Aenderung muss in einer anderen Migration passieren.

    • Pavlos Giannakis changed this line in version 29 of the diff

      changed this line in version 29 of the diff

    • Please register or sign in to reply
  • 33 33 op.add_column(
    34 34 "schema", sa.Column("ableitungsmodifikationen_repraesentation", sa.String)
    35 35 )
    36 op.add_column("schema", sa.Column("struktur", sa.ARRAY(sa.String)))
  • 1 from conftest import CommandRunner
    2 from fastapi.testclient import TestClient
    3
    4
    5 def test_search_schema_by_id(runner: CommandRunner, client: TestClient):
    6 response = client.get("/api/v0/schemas/search/id/S1234")
  • Zum ruff-Fehler: Hohl dir den neuesten Stand vom Main, die ruff warnings zur Formatierung sind da deaktiviert.

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading

    Consent

    On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.