Compare commits

...

2 Commits

Author SHA1 Message Date
Justin Weins 9b8171db5b Merge remote-tracking branch 'origin/main'
# Conflicts:
#	gen/openapi_server/controllers/patchnotes_controller.py
2025-04-16 14:11:45 +02:00
Justin Weins d38e4e0f69 added patchnotes_get function to return all patchnotes 2025-04-16 13:40:45 +02:00
1 changed files with 6 additions and 8 deletions

View File

@ -10,6 +10,7 @@ from __main__ import collection
from openapi_server.__main__ import collection
from openapi_server.models.patch_notes import PatchNotes # noqa: E501
def patchnotes_date_get(date): # noqa: E501
"""patchnotes_date_get
@ -20,6 +21,7 @@ def patchnotes_date_get(date): # noqa: E501
:rtype: Union[List[PatchNotes], Tuple[List[PatchNotes], int], Tuple[List[PatchNotes], int, Dict[str, str]]
"""
logging.error(type(date))
try:
datetime.strptime(date, '%Y-%m-%d') # 2025-01-0
except ValueError as e:
@ -28,6 +30,7 @@ def patchnotes_date_get(date): # noqa: E501
detail="The date is invalid. Needs to be in this Format YYYY-MM-DD",
status=400,
)
logging.error('date:' + str(date))
query = {
'patch_date': {'$gte': date}
}
@ -54,6 +57,7 @@ def patchnotes_patch_iddelete(patch_id): # noqa: E501
:rtype: Union[None, Tuple[None, int], Tuple[None, int, Dict[str, str]]
"""
deleted_doc = collection.delete_one({'patchID': patch_id})
logging.error(deleted_doc.deleted_count)
if deleted_doc.deleted_count == 0:
raise ProblemException(
title="Not found",
@ -105,6 +109,7 @@ def patchnotes_patch_idput(patch_id, body): # noqa: E501
detail="No document has been deleted",
status=404,
)
logging.error(result)
return Response("Document was updated", status=200, mimetype='application/json')
@ -152,14 +157,6 @@ def patchnotes_post(body):
return Response(json_util.dumps(patch_note), mimetype='application/json',
status=200)
def patchnotes_post(body):
"""patchnotes_post
@ -188,6 +185,7 @@ def patchnotes_post(body):
'patchID': str(uuid.uuid4()),
'title': pn.title,
'changes': pn.changes,
'version': pn.version,
'patch_date': date_str
}