From 94bcc9ee5bead41f210c5a276fe3f801f696b773 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Sun, 22 Dec 2024 18:21:26 +0100 Subject: [PATCH] add conition for put --- app/routers/events.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/routers/events.py b/app/routers/events.py index 585f115..471fd04 100644 --- a/app/routers/events.py +++ b/app/routers/events.py @@ -332,7 +332,10 @@ async def update_events(authorize: Annotated[bool, Depends(permissions_checker.P event_repository = events.EventRepository(database=database.database) tags_repository = tags.TagsRepository(database=database.database) - event = event_repository.find_one_by({"name": {'$eq': eventSingle.name}}) + event = event_repository.find_one_by( {"$and": [ + {"start_date": {"$eq": eventSingle.start_date}}, # Already started + {"name": {"$eq": eventSingle.name}}, + ]}) if event is not None: raise HTTPException( status_code=status.HTTP_204_NO_CONTENT,