diff --git a/api/api/db/logic/listevents.py b/api/api/db/logic/listevents.py index 7f1d0e1..b801a56 100644 --- a/api/api/db/logic/listevents.py +++ b/api/api/db/logic/listevents.py @@ -56,10 +56,11 @@ async def get_listevents_page_by_creator_id(connection: AsyncConnection, creator # Здесь предполагается, что all_list_event_adapter.validate_python корректно обрабатывает данные validated_list_event = all_list_event_adapter.validate_python(events_data) - return AllListEventResponse(list_event=validated_list_event, amount_count=total_count, amount_pages=total_pages) + return AllListEventResponse(list_event=validated_list_event, amount_count=total_count, amount_pages=total_pages, current_page=page, + limit = limit) -async def get_listevents_page(connection: AsyncConnection, page, limit) -> Optional[ListEvent]: +async def get_listevents_page(connection: AsyncConnection, page, limit) -> Optional[AllListEventResponse]: """ Получает список ползовелей заданных значениями page, limit. """ @@ -94,7 +95,8 @@ async def get_listevents_page(connection: AsyncConnection, page, limit) -> Optio # Здесь предполагается, что all_list_event_adapter.validate_python корректно обрабатывает данные validated_list_event = all_list_event_adapter.validate_python(events_data) - return AllListEventResponse(list_event=validated_list_event, amount_count=total_count, amount_pages=total_pages) + return AllListEventResponse(list_event=validated_list_event, amount_count=total_count, amount_pages=total_pages,current_page=page, + limit = limit) async def get_listevents_by_name(connection: AsyncConnection, name: str) -> Optional[ListEvent]: """ @@ -142,7 +144,7 @@ async def get_listevents_by_id(connection: AsyncConnection, id: int) -> Optional return ListEvent.model_validate(listevents_data) -async def update_listevents_by_id(connection: AsyncConnection, update_values, listevents) -> Optional[ListEvent]: +async def update_listevents_by_id(connection: AsyncConnection, update_values, listevents): """ Вносит изменеия в нужное поле таблицы account_table. """ diff --git a/api/api/endpoints/listevents.py b/api/api/endpoints/listevents.py index a9d6fce..c54b6c8 100644 --- a/api/api/endpoints/listevents.py +++ b/api/api/endpoints/listevents.py @@ -108,8 +108,8 @@ async def create_list_events( if listevents_validation is None: await create_listevents(connection, listevents, user_validation.id) - user_new = await get_listevents_by_name(connection, listevents.name) - return user_new + listevents_new = await get_listevents_by_name(connection, listevents.name) + return listevents_new else: raise HTTPException( diff --git a/api/api/schemas/endpoints/list_events.py b/api/api/schemas/endpoints/list_events.py index 762c00a..141026e 100644 --- a/api/api/schemas/endpoints/list_events.py +++ b/api/api/schemas/endpoints/list_events.py @@ -32,6 +32,7 @@ class AllListEventResponse(Base): list_event: List[AllListEvent] amount_count: int amount_pages: int - + current_page: int + limit: int all_list_event_adapter = TypeAdapter(List[AllListEvent])