Merge pull request 'add conition for put' (#37) from hotfix/fix-doublon into master

Reviewed-on: #37
This commit is contained in:
v4l3n71n 2024-12-22 18:27:46 +01:00
commit 1ae360b071

View File

@ -332,7 +332,10 @@ async def update_events(authorize: Annotated[bool, Depends(permissions_checker.P
event_repository = events.EventRepository(database=database.database) event_repository = events.EventRepository(database=database.database)
tags_repository = tags.TagsRepository(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: if event is not None:
raise HTTPException( raise HTTPException(
status_code=status.HTTP_204_NO_CONTENT, status_code=status.HTTP_204_NO_CONTENT,