From fb302ca63eccca0dd29d1819588c11ffd04bece6 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Mon, 20 Nov 2023 22:40:42 +0100 Subject: [PATCH] add latitude and longitude --- app/models/events.py | 4 ++++ app/routers/events.py | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/app/models/events.py b/app/models/events.py index fd187fd..9e1f7af 100644 --- a/app/models/events.py +++ b/app/models/events.py @@ -7,6 +7,8 @@ class Event(BaseModel): name: str place: str status: int = 0 + latitude: float = 0.0 + longitude: float = 0.0 organizers: list[str] = [] start_date: datetime | None = None end_date: datetime | None = None @@ -30,6 +32,8 @@ class EventIn(BaseModel): organizers: list[str] = [] start_date: datetime | None = None end_date: datetime | None = None + latitude: float = 0.0 + longitude: float = 0.0 class EventIDS(BaseModel): ids: list[str] diff --git a/app/routers/events.py b/app/routers/events.py index 987fca6..68099d5 100644 --- a/app/routers/events.py +++ b/app/routers/events.py @@ -132,6 +132,8 @@ async def update_events_me(item_id: str, current_user: Annotated[users.User, Dep event.place = EventSingle.place event.start_date = eventSingle.start_date event.end_date = eventSingle.end_date + event.latitude = eventSingle.latitude + event.longitude = eventSingle.longitude event.updated_at = datetime.today() event_repository.save(event) content = {"message": "event is updated"} @@ -159,6 +161,8 @@ async def update_events(authorize: Annotated[bool, Depends(permissions_checker.P event.start_date = eventSingle.start_date event.end_date = eventSingle.end_date event.organizers = eventSingle.organizers + event.latitude = eventSingle.latitude + event.longitude = eventSingle.longitude event.created_at = datetime.today() event_repository.save(event) content = {"message": "event is created"} @@ -187,6 +191,8 @@ async def update_events_id(item_id: str, authorize: Annotated[bool, Depends(perm event.start_date = eventSingle.start_date event.end_date = eventSingle.end_date event.organizers = eventSingle.organizers + event.latitude = eventSingle.latitude + event.longitude = eventSingle.longitude event.updated_at = datetime.today() event_repository.save(event) content = {"message": "event is updated"}