if changes
This commit is contained in:
parent
be28592dfa
commit
8f474a1081
|
|
@ -124,7 +124,7 @@ def list_patchnotes(since: str | None = None):
|
||||||
"""GET /patchnotes – liefert neue Patchnotes und setzt last_login."""
|
"""GET /patchnotes – liefert neue Patchnotes und setzt last_login."""
|
||||||
|
|
||||||
user_id = current_user_id() # 1) aktueller Benutzer
|
user_id = current_user_id() # 1) aktueller Benutzer
|
||||||
last_login = last_login_collection.find_one({"user_id": user_id},{"last_login"})
|
last_login = last_login_collection.find_one({"user_id": user_id}, {"last_login"})
|
||||||
if since is None:
|
if since is None:
|
||||||
try:
|
try:
|
||||||
docs = collection.find({})
|
docs = collection.find({})
|
||||||
|
|
@ -140,7 +140,7 @@ def list_patchnotes(since: str | None = None):
|
||||||
)
|
)
|
||||||
|
|
||||||
# 3) Datum validieren (nur wenn vorhanden)
|
# 3) Datum validieren (nur wenn vorhanden)
|
||||||
if since:
|
elif since:
|
||||||
query = {
|
query = {
|
||||||
"patch_date": {
|
"patch_date": {
|
||||||
"$gte": last_login,
|
"$gte": last_login,
|
||||||
|
|
@ -155,10 +155,8 @@ def list_patchnotes(since: str | None = None):
|
||||||
detail="since must be YYYY-MM-DD",
|
detail="since must be YYYY-MM-DD",
|
||||||
status=400,
|
status=400,
|
||||||
)
|
)
|
||||||
else:
|
|
||||||
query = {} # erster Login → alle Notes
|
|
||||||
|
|
||||||
# 4) Patchnotes abholen
|
# 4) Patchnotes abholen
|
||||||
|
|
||||||
docs = list(collection.find(query).sort("patch_date", 1))
|
docs = list(collection.find(query).sort("patch_date", 1))
|
||||||
for d in docs:
|
for d in docs:
|
||||||
d.pop("_id", None)
|
d.pop("_id", None)
|
||||||
|
|
@ -235,5 +233,3 @@ def update_patchnote(patch_id, body): # noqa: E501
|
||||||
mimetype="application/json",
|
mimetype="application/json",
|
||||||
status=200,
|
status=200,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue