add img path #16
@ -10,6 +10,7 @@ class Event(BaseModel):
|
||||
city: str
|
||||
country: str
|
||||
description: str
|
||||
imgUrl: str | None = None
|
||||
status: int = 0
|
||||
latitude: float = 0.0
|
||||
longitude: float = 0.0
|
||||
@ -29,6 +30,7 @@ class EventOut(BaseModel):
|
||||
city: str
|
||||
country: str
|
||||
description: str
|
||||
imgUrl: str | None = None
|
||||
status: int = 0
|
||||
start_date: datetime | None = None
|
||||
end_date: datetime | None = None
|
||||
@ -40,6 +42,7 @@ class EventIn(BaseModel):
|
||||
city: str
|
||||
country: str
|
||||
description: str
|
||||
imgUrl: str | None = None
|
||||
status: int = 0
|
||||
organizers: list[str] = []
|
||||
start_date: datetime | None = None
|
||||
|
@ -35,7 +35,7 @@ async def read_events(authorize: Annotated[bool, Depends(permissions_checker.Per
|
||||
|
||||
|
||||
for event_index in event_repository.find_by(object_search, limit=limit, skip=skip):
|
||||
event = events.EventOut(id=event_index.id, name=event_index.name, description=event_index.description, place=event_index.place, zip_code=event_index.zip_code, city=event_index.city, country=event_index.country, status=event_index.status, start_date=event_index.start_date, end_date=event_index.end_date)
|
||||
event = events.EventOut(id=event_index.id, imgUrl=event_index.imgUrl, name=event_index.name, description=event_index.description, place=event_index.place, zip_code=event_index.zip_code, city=event_index.city, country=event_index.country, status=event_index.status, start_date=event_index.start_date, end_date=event_index.end_date)
|
||||
listEvents.append(event)
|
||||
return listEvents
|
||||
|
||||
@ -46,7 +46,7 @@ async def read_users_me(current_user: Annotated[users.User, Depends(users_token.
|
||||
listOrganizers = []
|
||||
|
||||
for event_index in event_repository.find_by({"organizers":{"$eq": current_user.username}}, limit=limit, skip=skip):
|
||||
event = events.EventOut(id=event_index.id, name=event_index.name, description=event_index.description, place=event_index.place, zip_code=event_index.zip_code, city=event_index.city, country=event_index.country, status=event_index.status, start_date=event_index.start_date, end_date=event_index.end_date)
|
||||
event = events.EventOut(id=event_index.id, name=event_index.name, imgUrl=event_index.imgUrl, description=event_index.description, place=event_index.place, zip_code=event_index.zip_code, city=event_index.city, country=event_index.country, status=event_index.status, start_date=event_index.start_date, end_date=event_index.end_date)
|
||||
listOrganizers.append(event)
|
||||
|
||||
content = {"organizers":listOrganizers}
|
||||
@ -139,6 +139,7 @@ async def update_events_me(item_id: str, current_user: Annotated[users.User, Dep
|
||||
event.latitude = eventSingle.latitude
|
||||
event.longitude = eventSingle.longitude
|
||||
event.updated_at = datetime.today()
|
||||
event.imgUrl = eventSingle.imgUrl
|
||||
event_repository.save(event)
|
||||
content = {"message": "event is updated"}
|
||||
response = JSONResponse(content=content)
|
||||
@ -167,6 +168,7 @@ async def update_events(authorize: Annotated[bool, Depends(permissions_checker.P
|
||||
event.organizers = eventSingle.organizers
|
||||
event.latitude = eventSingle.latitude
|
||||
event.longitude = eventSingle.longitude
|
||||
event.imgUrl = eventSingle.imgUrl
|
||||
event.created_at = datetime.today()
|
||||
event_repository.save(event)
|
||||
content = {"message": "event is created"}
|
||||
@ -202,6 +204,7 @@ async def update_events_id(item_id: str, authorize: Annotated[bool, Depends(perm
|
||||
event.latitude = eventSingle.latitude
|
||||
event.longitude = eventSingle.longitude
|
||||
event.updated_at = datetime.today()
|
||||
event.imgUrl = eventSingle.imgUrl
|
||||
event_repository.save(event)
|
||||
content = {"message": "event is updated"}
|
||||
response = JSONResponse(content=content)
|
||||
|
Loading…
x
Reference in New Issue
Block a user