From 8f474a108110f60140bb3b3c20425ea649055c43 Mon Sep 17 00:00:00 2001 From: justinbaer Date: Thu, 26 Jun 2025 09:40:51 +0200 Subject: [PATCH] if changes --- .../controllers/patchnotes_controller.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/gen/openapi_server/controllers/patchnotes_controller.py b/gen/openapi_server/controllers/patchnotes_controller.py index fd2caf3..ab812cc 100644 --- a/gen/openapi_server/controllers/patchnotes_controller.py +++ b/gen/openapi_server/controllers/patchnotes_controller.py @@ -123,8 +123,8 @@ def get_patchnote(patch_id): # noqa: E501 def list_patchnotes(since: str | None = None): """GET /patchnotes – liefert neue Patchnotes und setzt last_login.""" - user_id = current_user_id() # 1) aktueller Benutzer - last_login = last_login_collection.find_one({"user_id": user_id},{"last_login"}) + user_id = current_user_id() # 1) aktueller Benutzer + last_login = last_login_collection.find_one({"user_id": user_id}, {"last_login"}) if since is None: try: docs = collection.find({}) @@ -140,7 +140,7 @@ def list_patchnotes(since: str | None = None): ) # 3) Datum validieren (nur wenn vorhanden) - if since: + elif since: query = { "patch_date": { "$gte": last_login, @@ -155,10 +155,8 @@ def list_patchnotes(since: str | None = None): detail="since must be YYYY-MM-DD", status=400, ) - else: - query = {} # erster Login → alle Notes - # 4) Patchnotes abholen + docs = list(collection.find(query).sort("patch_date", 1)) for d in docs: d.pop("_id", None) @@ -235,5 +233,3 @@ def update_patchnote(patch_id, body): # noqa: E501 mimetype="application/json", status=200, ) - -