add description #15

Merged
v4l3n71n merged 1 commits from feature/add-description into master 2024-09-03 13:45:16 +00:00
2 changed files with 8 additions and 3 deletions
Showing only changes of commit 0a33551fa7 - Show all commits

View File

@ -9,6 +9,7 @@ class Event(BaseModel):
zip_code: str
city: str
country: str
description: str
status: int = 0
latitude: float = 0.0
longitude: float = 0.0
@ -27,6 +28,7 @@ class EventOut(BaseModel):
zip_code: str
city: str
country: str
description: str
status: int = 0
start_date: datetime | None = None
end_date: datetime | None = None
@ -37,6 +39,7 @@ class EventIn(BaseModel):
zip_code: str
city: str
country: str
description: str
status: int = 0
organizers: list[str] = []
start_date: datetime | None = None

View File

@ -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, 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, 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, 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, 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}
@ -129,6 +129,7 @@ async def update_events_me(item_id: str, current_user: Annotated[users.User, Dep
event_repository = event.EventRepository(database=database.database)
event = event_repository.find_one_by_id(ObjectId(item_id))
event.name = eventSingle.name
event.description = eventSingle.description
event.place = eventSingle.place
event.zip_code = eventSingle.zip_code
event.city = eventSingle.city
@ -160,7 +161,7 @@ async def update_events(authorize: Annotated[bool, Depends(permissions_checker.P
)
event = events.Event(name=eventSingle.name, place=eventSingle.place, zip_code=eventSingle.zip_code, city=eventSingle.city, country=eventSingle.country)
event = events.Event(name=eventSingle.name, description=eventSingle.description, place=eventSingle.place, zip_code=eventSingle.zip_code, city=eventSingle.city, country=eventSingle.country)
event.start_date = eventSingle.start_date
event.end_date = eventSingle.end_date
event.organizers = eventSingle.organizers
@ -191,6 +192,7 @@ async def update_events_id(item_id: str, authorize: Annotated[bool, Depends(perm
event.name = eventSingle.name
event.place = eventSingle.place
event.description = eventSingle.description
event.zip_code = eventSingle.zip_code
event.city = eventSingle.city
event.country = eventSingle.country