From e1444e098d46b5f8c8ea615e1360bf267505af8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pauline=20Gr=C3=BCndel?= <gruendel@uni-potsdam.de> Date: Fri, 10 Jan 2025 19:35:20 +0100 Subject: [PATCH] =?UTF-8?q?methode=20id=20nicht=20negativ=20hinzugef=C3=BC?= =?UTF-8?q?gt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Backend/backend.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Backend/backend.py b/Backend/backend.py index bd305f5..fecab4f 100644 --- a/Backend/backend.py +++ b/Backend/backend.py @@ -52,6 +52,11 @@ class Project(BaseModel): if not re.match(r"^(0[1-9]|1[0-2])-\d{4}$", value): raise ValueError("Das Datum muss im Format MM-YYYY sein.") return value + + def validate_id(cls, value): + if id < 0: + raise ValueError("Die id muss positiv sein.") + return value def load_projects(): -- GitLab