Compare commits

..
58 Commits
Author SHA1 Message Date
Marcel-Wefers b1be7152a7 pipeline-test 2025-08-11 10:30:54 +02:00
Marcel-Wefers aa14131757 Dockerfile aktualisiert 2025-07-01 13:34:44 +02:00
Marcel-Wefers 21a76418fe Pipeline fail test 2025-07-01 13:33:23 +02:00
Marcel-Wefers 4223ec2e72 pipeline fail test 2025-07-01 13:29:54 +02:00
Marcel-Wefers 8981fe6fda test.txt aktualisiert 2025-07-01 12:18:59 +02:00
Marcel-Wefers f434e39c32 test.txt aktualisiert 2025-07-01 12:18:40 +02:00
Marcel-Wefers 1417057160 dssdsd 2025-07-01 12:07:56 +02:00
Marcel-Wefers 742b4bfc32 test.txt aktualisiert 2025-07-01 12:04:02 +02:00
Marcel-Wefers bc0775eafe 123 2025-07-01 12:00:33 +02:00
Marcel-Wefers c778d3422c jnjnjnjn 2025-07-01 11:51:59 +02:00
Marcel-Wefers 14f9040456 test123 2025-07-01 11:49:15 +02:00
Marcel-Wefers 8dfa89c6b6 pray pray pray 2025-07-01 11:39:08 +02:00
Marcel-Wefers a32111fbf4 please work 2025-07-01 11:36:22 +02:00
Marcel-Wefers 6772c5e408 funktioniert? 2025-07-01 11:32:43 +02:00
Marcel-Wefers 156012ad64 pipeline test 2025-07-01 11:29:17 +02:00
Marcel-Wefers d3429cefb4 test.txt aktualisiert 2025-07-01 11:28:50 +02:00
Marcel-Wefers 397a1844b5 test123 2025-07-01 11:12:13 +02:00
Marcel-Wefers 412e9f03bb test.txt aktualisiert 2025-07-01 11:08:56 +02:00
Marcel-Wefers 76342d3d55 test.txt aktualisiert 2025-07-01 11:03:39 +02:00
Marcel-Wefers eced2dc1e9 test.txt aktualisiert 2025-07-01 10:55:24 +02:00
Marcel-Wefers e692a50efc test.txt aktualisiert 2025-07-01 10:51:29 +02:00
Marcel-Wefers f097fd8c43 test.txt aktualisiert 2025-07-01 10:48:11 +02:00
Marcel-Wefers e211b7f680 test.txt aktualisiert 2025-07-01 10:45:06 +02:00
Marcel-Wefers 72ade7f92c test.txt aktualisiert 2025-07-01 10:42:15 +02:00
Marcel-Wefers 72f8196acf test.txt aktualisiert 2025-07-01 10:41:41 +02:00
Marcel-Wefers b087d9822e test.txt aktualisiert 2025-07-01 10:35:21 +02:00
Marcel-Wefers 785f6ac8b9 test.txt aktualisiert 2025-07-01 10:31:53 +02:00
Marcel-Wefers 20d80d76f0 test.txt aktualisiert 2025-07-01 10:28:44 +02:00
Marcel-Wefers 6a75825a88 test123 2025-07-01 10:24:56 +02:00
Marcel-Wefers 5599476730 test.txt aktualisiert 2025-07-01 10:16:33 +02:00
Marcel-Wefers d13738069e test123
dfsfdsf
2025-07-01 10:11:08 +02:00
Marcel-Wefers 5aec5ae176 svadgasvd
sjdbkjdsbf
2025-07-01 10:06:45 +02:00
Marcel-Wefers 186cf4411e test123 2025-07-01 10:00:05 +02:00
Marcel-Wefers 435e0260e5 test123 2025-07-01 09:52:34 +02:00
Marcel-Wefers eaf6b09349 test.txt aktualisiert 2025-07-01 09:35:17 +02:00
Weins 405639329c getting last_login changes 2025-06-26 11:29:08 +02:00
Weins 719b9d7000 Query changes for DB 2025-06-26 11:18:51 +02:00
Weins e3270d64bf Query changes for DB 2025-06-26 11:04:26 +02:00
Weins f97d8e53b1 logging basicConfig changed in patchnotes_controller.py 2025-06-26 10:59:41 +02:00
Weins 1d8b138b62 added logs for debugging 2025-06-26 10:55:06 +02:00
Weins 75cc0b46f9 Merge remote-tracking branch 'origin/main'
# Conflicts:
#	gen/openapi_server/controllers/patchnotes_controller.py
2025-06-26 10:44:35 +02:00
Weins 3cddbe4922 added logs for debugging 2025-06-26 10:42:56 +02:00
Weins 58645f87ea added logs for debugging 2025-06-26 10:34:55 +02:00
Weins b58b56249a list_patchnotes to fix encoding error 2025-06-26 10:06:56 +02:00
Weins 5ec51451ee list_patchnotes to fix unbound variable error 2025-06-26 09:58:55 +02:00
Weins 8d4bcfdf0c if changes 2025-06-26 09:46:35 +02:00
Weins 8f474a1081 if changes 2025-06-26 09:40:51 +02:00
Weins be28592dfa query changes 2025-06-26 09:22:47 +02:00
Weins 11087ead17 if today and last login is same date docs is empty in patchnotes_controller.py 2025-06-26 08:47:34 +02:00
Weins 2bfc56ea81 if today and last login is same date docs is empty in patchnotes_controller.py 2025-06-25 13:53:27 +02:00
Weins dcc02ab60d patchnotes controller updated 2025-06-25 13:19:34 +02:00
Marcel-Wefers 4017708282 test.txt aktualisiert 2025-06-25 13:10:08 +02:00
Weins 4df2a1dede patchnotes controller updated 2025-06-25 12:59:56 +02:00
Weins b6cfe62724 patch_notes.py changes 2025-05-26 16:53:50 +02:00
Weins 96dd142899 yaml changes due to function not being used 2025-05-26 15:48:42 +02:00
Weins 7ae97c27a0 regex changes for CORS 2025-05-26 15:39:18 +02:00
Weins bbe550b8a9 Merge remote-tracking branch 'origin/main' 2025-05-26 14:24:13 +02:00
Weins de15af4302 .yaml changes to add project
controller changes to add project in creation / updates
2025-05-26 14:24:01 +02:00
10 changed files with 127 additions and 98 deletions
+1 -1
View File
@@ -15,4 +15,4 @@ EXPOSE 8080
ENTRYPOINT ["python3"] ENTRYPOINT ["python3"]
CMD ["-m", "openapi_server"] CMD ["-m", "openapi_server"]
+9 -21
View File
@@ -52,24 +52,6 @@ paths:
$ref: '#/components/schemas/patch_notes' $ref: '#/components/schemas/patch_notes'
"400": "400":
description: bad payload description: bad payload
/patchnotes/all:
get:
tags: [Patchnotes]
summary: Returns **all** patch notes (admin area)
operationId: listAllPatchnotes
responses:
"200":
description: list of all patch notes
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/patch_notes'
"404":
description: no Patch notes found
/patchnotes/{patchID}: /patchnotes/{patchID}:
parameters: parameters:
- in: path - in: path
@@ -151,13 +133,16 @@ components:
patch_date: patch_date:
type: string type: string
format: date format: date
required: [patchID, title, changes, version, patch_date] project:
type: string
required: [patchID, title, changes, version, patch_date, project]
example: example:
patchID: 29e80bcc-5981-4a52-99e1-373442dea9b9 patchID: 29e80bcc-5981-4a52-99e1-373442dea9b9
title: Patch note 1 title: Patch note 1
changes: Fixed export bug changes: Fixed export bug
version: 1.0.0 version: 1.0.0
patch_date: '2025-01-02' # ← als String in Quotes! patch_date: '2025-01-02' # ← als String in Quotes!
project: 'Test-Projekt'
patch_notes_input: patch_notes_input:
description: Schema for POST/PUT (server generates patchID if omitted) description: Schema for POST/PUT (server generates patchID if omitted)
@@ -172,12 +157,15 @@ components:
patch_date: patch_date:
type: string type: string
format: date format: date
required: [title, changes, version, patch_date] project:
type: string
required: [title, changes, version, patch_date, project]
example: example:
title: Patch note 1 title: Patch note 1
changes: Fixed export bug changes: Fixed export bug
version: 1.0.0 version: 1.0.0
patch_date: '2025-01-02' # ← ebenfalls in Quotes patch_date: '2025-01-02' # ← ebenfalls in Quotes
project: 'Test-Projekt'
responses: responses:
Error400: Error400:
-3
View File
@@ -5,12 +5,9 @@ Dockerfile
README.md README.md
git_push.sh git_push.sh
openapi_server/__init__.py openapi_server/__init__.py
openapi_server/__main__.py
openapi_server/controllers/__init__.py openapi_server/controllers/__init__.py
openapi_server/controllers/patchnotes_controller.py
openapi_server/controllers/security_controller.py openapi_server/controllers/security_controller.py
openapi_server/models/__init__.py openapi_server/models/__init__.py
openapi_server/models/base_model.py
openapi_server/models/patch_notes.py openapi_server/models/patch_notes.py
openapi_server/models/patch_notes_input.py openapi_server/models/patch_notes_input.py
openapi_server/openapi/openapi.yaml openapi_server/openapi/openapi.yaml
+1 -1
View File
@@ -24,7 +24,7 @@ app = connexion.FlaskApp(__name__, specification_dir='./openapi/')
app.add_middleware( app.add_middleware(
CORSMiddleware, CORSMiddleware,
position=MiddlewarePosition.BEFORE_EXCEPTION, position=MiddlewarePosition.BEFORE_EXCEPTION,
allow_origin_regex=r"^(https?://)(.*kanzleiapp\.io|.*masasana\.ai|localhost:4200)$", allow_origin_regex=r"^https?://(.*\.kanzleiapp\.io|.*\.masasana\.ai|localhost:4200)$",
allow_credentials=True, allow_credentials=True,
allow_methods=["*"], allow_methods=["*"],
allow_headers=["*"], allow_headers=["*"],
@@ -19,6 +19,7 @@ from openapi_server.__main__ import collection, last_login_collection
from openapi_server.models.patch_notes import PatchNotes from openapi_server.models.patch_notes import PatchNotes
from openapi_server.utils.auth import current_user_id from openapi_server.utils.auth import current_user_id
logging.basicConfig(level=logging.INFO)
def create_patchnote(body): # noqa: E501 def create_patchnote(body): # noqa: E501
"""Creates new patch notes """Creates new patch notes
@@ -37,7 +38,7 @@ def create_patchnote(body): # noqa: E501
pn = PatchNotes.from_dict(body) pn = PatchNotes.from_dict(body)
# --- Datum wahlweise als str oder date annehmen --- # --- Datum wahlweise als str oder Date annehmen ---
if isinstance(pn.patch_date, date): if isinstance(pn.patch_date, date):
date_str = pn.patch_date.isoformat() date_str = pn.patch_date.isoformat()
else: else:
@@ -56,6 +57,7 @@ def create_patchnote(body): # noqa: E501
"changes": pn.changes, "changes": pn.changes,
"version": pn.version, "version": pn.version,
"patch_date": date_str, "patch_date": date_str,
"project": pn.project
} }
collection.insert_one(patch_doc) collection.insert_one(patch_doc)
@@ -122,15 +124,19 @@ def get_patchnote(patch_id): # noqa: E501
def list_patchnotes(since: str | None = None): 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_doc = last_login_collection.find_one(
{"user_id": user_id},
{"_id": 0, "last_login": 1}
)
last_login = last_login_doc.get("last_login") if last_login_doc else None
# 2) Wenn ?since fehlt, gespeichertes last_login holen query = {}
if since is None: logging.info("since" + str(since))
rec = last_login_collection.find_one({"user_id": user_id}) logging.info("last_login" + str(last_login))
since = rec["last_login"] if rec else None
# 3) Datum validieren (nur wenn vorhanden)
if since: if since:
logging.info("Went into if since")
try: try:
datetime.strptime(since, "%Y-%m-%d") datetime.strptime(since, "%Y-%m-%d")
except ValueError: except ValueError:
@@ -139,12 +145,31 @@ 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,
) )
mongo_filter = {"patch_date": {"$gte": since}} query = {
else: "patch_date": {
mongo_filter = {} # erster Login → alle Notes "$gte": since,
"$lte": last_login
}
}
# 3) Datum validieren (nur wenn vorhanden)
elif since is None:
logging.info("Went into if since is None")
try:
docs = collection.find({})
for d in docs:
d.pop("_id", None)
if isinstance(d["patch_date"], (datetime, date)):
d["patch_date"] = d["patch_date"].isoformat()
except ValueError as e:
raise ProblemException(
title="Internal Server Error",
detail=str(e),
status=500,
)
# 4) Patchnotes abholen # 4) Patchnotes abholen
docs = list(collection.find(mongo_filter).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)
if isinstance(d["patch_date"], (datetime, date)): if isinstance(d["patch_date"], (datetime, date)):
@@ -157,7 +182,6 @@ def list_patchnotes(since: str | None = None):
{"$set": {"last_login": today}}, {"$set": {"last_login": today}},
upsert=True, upsert=True,
) )
return Response(json_util.dumps(docs), mimetype="application/json", status=200) return Response(json_util.dumps(docs), mimetype="application/json", status=200)
@@ -199,6 +223,7 @@ def update_patchnote(patch_id, body): # noqa: E501
"changes": pn.changes, "changes": pn.changes,
"version": pn.version, "version": pn.version,
"patch_date": date_str, # richtiger Feldname! "patch_date": date_str, # richtiger Feldname!
"project": pn.project,
}} }}
) )
@@ -217,5 +242,3 @@ def update_patchnote(patch_id, body): # noqa: E501
mimetype="application/json", mimetype="application/json",
status=200, status=200,
) )
+31 -3
View File
@@ -12,7 +12,7 @@ class PatchNotes(Model):
Do not edit the class manually. Do not edit the class manually.
""" """
def __init__(self, patch_id=None, title=None, changes=None, version=None, patch_date=None): # noqa: E501 def __init__(self, patch_id=None, title=None, changes=None, version=None, patch_date=None, project=None): # noqa: E501
"""PatchNotes - a model defined in OpenAPI """PatchNotes - a model defined in OpenAPI
:param patch_id: The patch_id of this PatchNotes. # noqa: E501 :param patch_id: The patch_id of this PatchNotes. # noqa: E501
@@ -25,13 +25,16 @@ class PatchNotes(Model):
:type version: str :type version: str
:param patch_date: The patch_date of this PatchNotes. # noqa: E501 :param patch_date: The patch_date of this PatchNotes. # noqa: E501
:type patch_date: date :type patch_date: date
:param project: The project of this PatchNotes. # noqa: E501
:type project: str
""" """
self.openapi_types = { self.openapi_types = {
'patch_id': str, 'patch_id': str,
'title': str, 'title': str,
'changes': str, 'changes': str,
'version': str, 'version': str,
'patch_date': date 'patch_date': str,
'project': str
} }
self.attribute_map = { self.attribute_map = {
@@ -39,7 +42,8 @@ class PatchNotes(Model):
'title': 'title', 'title': 'title',
'changes': 'changes', 'changes': 'changes',
'version': 'version', 'version': 'version',
'patch_date': 'patch_date' 'patch_date': 'patch_date',
'project': 'project'
} }
self._patch_id = patch_id self._patch_id = patch_id
@@ -47,6 +51,7 @@ class PatchNotes(Model):
self._changes = changes self._changes = changes
self._version = version self._version = version
self._patch_date = patch_date self._patch_date = patch_date
self._project = project
@classmethod @classmethod
def from_dict(cls, dikt) -> 'PatchNotes': def from_dict(cls, dikt) -> 'PatchNotes':
@@ -173,3 +178,26 @@ class PatchNotes(Model):
raise ValueError("Invalid value for `patch_date`, must not be `None`") # noqa: E501 raise ValueError("Invalid value for `patch_date`, must not be `None`") # noqa: E501
self._patch_date = patch_date self._patch_date = patch_date
@property
def project(self) -> str:
"""Gets the project of this PatchNotes.
:return: The project of this PatchNotes.
:rtype: str
"""
return self._project
@project.setter
def project(self, project: str):
"""Sets the project of this PatchNotes.
:param project: The project of this PatchNotes.
:type project: str
"""
if project is None:
raise ValueError("Invalid value for `project`, must not be `None`") # noqa: E501
self._project = project
+31 -3
View File
@@ -12,7 +12,7 @@ class PatchNotesInput(Model):
Do not edit the class manually. Do not edit the class manually.
""" """
def __init__(self, title=None, changes=None, version=None, patch_date=None): # noqa: E501 def __init__(self, title=None, changes=None, version=None, patch_date=None, project=None): # noqa: E501
"""PatchNotesInput - a model defined in OpenAPI """PatchNotesInput - a model defined in OpenAPI
:param title: The title of this PatchNotesInput. # noqa: E501 :param title: The title of this PatchNotesInput. # noqa: E501
@@ -23,25 +23,30 @@ class PatchNotesInput(Model):
:type version: str :type version: str
:param patch_date: The patch_date of this PatchNotesInput. # noqa: E501 :param patch_date: The patch_date of this PatchNotesInput. # noqa: E501
:type patch_date: date :type patch_date: date
:param project: The project of this PatchNotesInput. # noqa: E501
:type project: str
""" """
self.openapi_types = { self.openapi_types = {
'title': str, 'title': str,
'changes': str, 'changes': str,
'version': str, 'version': str,
'patch_date': date 'patch_date': date,
'project': str
} }
self.attribute_map = { self.attribute_map = {
'title': 'title', 'title': 'title',
'changes': 'changes', 'changes': 'changes',
'version': 'version', 'version': 'version',
'patch_date': 'patch_date' 'patch_date': 'patch_date',
'project': 'project'
} }
self._title = title self._title = title
self._changes = changes self._changes = changes
self._version = version self._version = version
self._patch_date = patch_date self._patch_date = patch_date
self._project = project
@classmethod @classmethod
def from_dict(cls, dikt) -> 'PatchNotesInput': def from_dict(cls, dikt) -> 'PatchNotesInput':
@@ -145,3 +150,26 @@ class PatchNotesInput(Model):
raise ValueError("Invalid value for `patch_date`, must not be `None`") # noqa: E501 raise ValueError("Invalid value for `patch_date`, must not be `None`") # noqa: E501
self._patch_date = patch_date self._patch_date = patch_date
@property
def project(self) -> str:
"""Gets the project of this PatchNotesInput.
:return: The project of this PatchNotesInput.
:rtype: str
"""
return self._project
@project.setter
def project(self, project: str):
"""Sets the project of this PatchNotesInput.
:param project: The project of this PatchNotesInput.
:type project: str
"""
if project is None:
raise ValueError("Invalid value for `project`, must not be `None`") # noqa: E501
self._project = project
+14 -49
View File
@@ -22,27 +22,6 @@ paths:
format: date format: date
type: string type: string
style: form style: form
- description: Maximum number of items to return
explode: true
in: query
name: limit
required: false
schema:
default: 20
maximum: 100
minimum: 1
type: integer
style: form
- description: Pagination offset
explode: true
in: query
name: offset
required: false
schema:
default: 0
minimum: 0
type: integer
style: form
responses: responses:
"200": "200":
content: content:
@@ -176,29 +155,6 @@ components:
format: date format: date
type: string type: string
style: form style: form
LimitParam:
description: Maximum number of items to return
explode: true
in: query
name: limit
required: false
schema:
default: 20
maximum: 100
minimum: 1
type: integer
style: form
OffsetParam:
description: Pagination offset
explode: true
in: query
name: offset
required: false
schema:
default: 0
minimum: 0
type: integer
style: form
responses: responses:
Error400: Error400:
description: Invalid request payload description: Invalid request payload
@@ -212,6 +168,7 @@ components:
changes: Fixed export bug changes: Fixed export bug
version: 1.0.0 version: 1.0.0
patch_date: 2025-01-02 patch_date: 2025-01-02
project: Test-Projekt
properties: properties:
patchID: patchID:
format: uuid format: uuid
@@ -225,33 +182,41 @@ components:
patch_date: patch_date:
format: date format: date
type: string type: string
project:
type: string
required: required:
- changes - changes
- patchID - patchID
- patch_date - patch_date
- project
- title - title
- version - version
title: patch_notes title: patch_notes
type: object type: object
patch_notes_input: patch_notes_input:
description: Schema for POST/PUT (server generates patchID & patch_date if omitted) description: Schema for POST/PUT (server generates patchID if omitted)
example:
title: Patch note 1
changes: Fixed export bug
version: 1.0.0
patch_date: 2025-01-02
project: Test-Projekt
properties: properties:
title: title:
title: title
type: string type: string
changes: changes:
title: changes
type: string type: string
version: version:
title: version
type: string type: string
patch_date: patch_date:
format: date format: date
title: patch_date type: string
project:
type: string type: string
required: required:
- changes - changes
- patch_date - patch_date
- project
- title - title
- version - version
title: patch_notes_input title: patch_notes_input
+1 -1
View File
@@ -1 +1 @@
eeee 123
+1 -1
View File
@@ -1 +1 @@
test dsdsdsdsdsdkksdsddsdlml