Merge pull request 'add tags for event models' (#17) from feature/category into master
Reviewed-on: #17
This commit is contained in:
commit
84d8f7fd12
@ -15,6 +15,7 @@ class Event(BaseModel):
|
|||||||
latitude: float = 0.0
|
latitude: float = 0.0
|
||||||
longitude: float = 0.0
|
longitude: float = 0.0
|
||||||
organizers: list[str] = []
|
organizers: list[str] = []
|
||||||
|
tags: list[str] = []
|
||||||
start_date: datetime | None = None
|
start_date: datetime | None = None
|
||||||
end_date: datetime | None = None
|
end_date: datetime | None = None
|
||||||
created_at: datetime = datetime.today()
|
created_at: datetime = datetime.today()
|
||||||
@ -34,6 +35,7 @@ class EventOut(BaseModel):
|
|||||||
status: int = 0
|
status: int = 0
|
||||||
start_date: datetime | None = None
|
start_date: datetime | None = None
|
||||||
end_date: datetime | None = None
|
end_date: datetime | None = None
|
||||||
|
tags: list[str] = []
|
||||||
|
|
||||||
class EventIn(BaseModel):
|
class EventIn(BaseModel):
|
||||||
name: str
|
name: str
|
||||||
@ -45,6 +47,7 @@ class EventIn(BaseModel):
|
|||||||
imgUrl: str | None = None
|
imgUrl: str | None = None
|
||||||
status: int = 0
|
status: int = 0
|
||||||
organizers: list[str] = []
|
organizers: list[str] = []
|
||||||
|
tags: list[str] = []
|
||||||
start_date: datetime | None = None
|
start_date: datetime | None = None
|
||||||
end_date: datetime | None = None
|
end_date: datetime | None = None
|
||||||
latitude: float = 0.0
|
latitude: float = 0.0
|
||||||
|
@ -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):
|
for event_index in event_repository.find_by(object_search, limit=limit, skip=skip):
|
||||||
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)
|
event = events.EventOut(id=event_index.id, tags=event_index.tags, 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)
|
listEvents.append(event)
|
||||||
return listEvents
|
return listEvents
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ async def read_users_me(current_user: Annotated[users.User, Depends(users_token.
|
|||||||
listOrganizers = []
|
listOrganizers = []
|
||||||
|
|
||||||
for event_index in event_repository.find_by({"organizers":{"$eq": current_user.username}}, limit=limit, skip=skip):
|
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, 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)
|
event = events.EventOut(id=event_index.id, name=event_index.name, tags=event_index.tags, 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)
|
listOrganizers.append(event)
|
||||||
|
|
||||||
content = {"organizers":listOrganizers}
|
content = {"organizers":listOrganizers}
|
||||||
@ -135,6 +135,7 @@ async def update_events_me(item_id: str, current_user: Annotated[users.User, Dep
|
|||||||
event.city = eventSingle.city
|
event.city = eventSingle.city
|
||||||
event.country = eventSingle.country
|
event.country = eventSingle.country
|
||||||
event.start_date = eventSingle.start_date
|
event.start_date = eventSingle.start_date
|
||||||
|
event.tags = eventSingle.tags
|
||||||
event.end_date = eventSingle.end_date
|
event.end_date = eventSingle.end_date
|
||||||
event.latitude = eventSingle.latitude
|
event.latitude = eventSingle.latitude
|
||||||
event.longitude = eventSingle.longitude
|
event.longitude = eventSingle.longitude
|
||||||
@ -169,6 +170,7 @@ async def update_events(authorize: Annotated[bool, Depends(permissions_checker.P
|
|||||||
event.latitude = eventSingle.latitude
|
event.latitude = eventSingle.latitude
|
||||||
event.longitude = eventSingle.longitude
|
event.longitude = eventSingle.longitude
|
||||||
event.imgUrl = eventSingle.imgUrl
|
event.imgUrl = eventSingle.imgUrl
|
||||||
|
event.tags = eventSingle.tags
|
||||||
event.created_at = datetime.today()
|
event.created_at = datetime.today()
|
||||||
event_repository.save(event)
|
event_repository.save(event)
|
||||||
content = {"message": "event is created"}
|
content = {"message": "event is created"}
|
||||||
@ -201,6 +203,7 @@ async def update_events_id(item_id: str, authorize: Annotated[bool, Depends(perm
|
|||||||
event.start_date = eventSingle.start_date
|
event.start_date = eventSingle.start_date
|
||||||
event.end_date = eventSingle.end_date
|
event.end_date = eventSingle.end_date
|
||||||
event.organizers = eventSingle.organizers
|
event.organizers = eventSingle.organizers
|
||||||
|
event.tags = eventSingle.tags
|
||||||
event.latitude = eventSingle.latitude
|
event.latitude = eventSingle.latitude
|
||||||
event.longitude = eventSingle.longitude
|
event.longitude = eventSingle.longitude
|
||||||
event.updated_at = datetime.today()
|
event.updated_at = datetime.today()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user