Merge pull request 'fix build error' (#12) from feature/more-detail-place into master
Reviewed-on: #12
This commit is contained in:
commit
3477ed90a5
@ -6,6 +6,9 @@ class Event(BaseModel):
|
|||||||
id: ObjectIdField = None
|
id: ObjectIdField = None
|
||||||
name: str
|
name: str
|
||||||
place: str
|
place: str
|
||||||
|
zip_code: str
|
||||||
|
city: str
|
||||||
|
country: str
|
||||||
status: int = 0
|
status: int = 0
|
||||||
latitude: float = 0.0
|
latitude: float = 0.0
|
||||||
longitude: float = 0.0
|
longitude: float = 0.0
|
||||||
@ -21,6 +24,9 @@ class EventOut(BaseModel):
|
|||||||
id: ObjectIdField = None
|
id: ObjectIdField = None
|
||||||
name: str
|
name: str
|
||||||
place: str
|
place: str
|
||||||
|
zip_code: str
|
||||||
|
city: str
|
||||||
|
country: str
|
||||||
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
|
||||||
@ -28,6 +34,9 @@ class EventOut(BaseModel):
|
|||||||
class EventIn(BaseModel):
|
class EventIn(BaseModel):
|
||||||
name: str
|
name: str
|
||||||
place: str
|
place: str
|
||||||
|
zip_code: str
|
||||||
|
city: str
|
||||||
|
country: str
|
||||||
status: int = 0
|
status: int = 0
|
||||||
organizers: list[str] = []
|
organizers: list[str] = []
|
||||||
start_date: datetime | None = None
|
start_date: datetime | None = None
|
||||||
|
@ -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, place=event_index.place, 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, 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}
|
||||||
@ -128,8 +128,11 @@ async def delete_events_id(item_id : str, authorize: Annotated[bool, Depends(per
|
|||||||
async def update_events_me(item_id: str, current_user: Annotated[users.User, Depends(users_token.get_current_active_user)], authorize: Annotated[bool, Depends(permissions_checker.PermissionChecker(roles=["Admin", "User"]))], eventSingle: events.EventIn | None = None):
|
async def update_events_me(item_id: str, current_user: Annotated[users.User, Depends(users_token.get_current_active_user)], authorize: Annotated[bool, Depends(permissions_checker.PermissionChecker(roles=["Admin", "User"]))], eventSingle: events.EventIn | None = None):
|
||||||
event_repository = event.EventRepository(database=database.database)
|
event_repository = event.EventRepository(database=database.database)
|
||||||
event = event_repository.find_one_by_id(ObjectId(item_id))
|
event = event_repository.find_one_by_id(ObjectId(item_id))
|
||||||
event.name = EventSingle.name
|
event.name = eventSingle.name
|
||||||
event.place = EventSingle.place
|
event.place = eventSingle.place
|
||||||
|
event.zip_code = eventSingle.zip_code
|
||||||
|
event.city = eventSingle.city
|
||||||
|
event.country = eventSingle.country
|
||||||
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.latitude = eventSingle.latitude
|
event.latitude = eventSingle.latitude
|
||||||
@ -160,6 +163,10 @@ async def update_events(authorize: Annotated[bool, Depends(permissions_checker.P
|
|||||||
event = events.Event(name=eventSingle.name, place=eventSingle.place)
|
event = events.Event(name=eventSingle.name, place=eventSingle.place)
|
||||||
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.place = eventSingle.place
|
||||||
|
event.zip_code = eventSingle.zip_code
|
||||||
|
event.city = eventSingle.city
|
||||||
|
event.country = eventSingle.country
|
||||||
event.organizers = eventSingle.organizers
|
event.organizers = eventSingle.organizers
|
||||||
event.latitude = eventSingle.latitude
|
event.latitude = eventSingle.latitude
|
||||||
event.longitude = eventSingle.longitude
|
event.longitude = eventSingle.longitude
|
||||||
@ -188,6 +195,9 @@ async def update_events_id(item_id: str, authorize: Annotated[bool, Depends(perm
|
|||||||
|
|
||||||
event.name = eventSingle.name
|
event.name = eventSingle.name
|
||||||
event.place = eventSingle.place
|
event.place = eventSingle.place
|
||||||
|
event.zip_code = eventSingle.zip_code
|
||||||
|
event.city = eventSingle.city
|
||||||
|
event.country = eventSingle.country
|
||||||
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user