add latitude and longitude

This commit is contained in:
Valentin CZERYBA 2023-11-20 22:40:42 +01:00
parent 6edc87fb1d
commit fb302ca63e
2 changed files with 10 additions and 0 deletions

View File

@ -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]

View File

@ -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"}