WIP: feat: CRUD ListEvent #14
@ -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)
|
||||
|
||||
ivan.dev marked this conversation as resolved
Outdated
|
||||
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)
|
||||
ivan.dev marked this conversation as resolved
vlad.dev
commented
Тоже returning type не соответствует Тоже returning type не соответствует
|
||||
|
||||
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.
|
||||
ivan.dev marked this conversation as resolved
vlad.dev
commented
Тоже из другого метода описание Тоже из другого метода описание
|
||||
"""
|
||||
|
@ -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)
|
||||
ivan.dev marked this conversation as resolved
Outdated
vlad.dev
commented
Имя переменной я бы поменял) Имя переменной я бы поменял)
|
||||
return listevents_new
|
||||
|
||||
else:
|
||||
raise HTTPException(
|
||||
|
@ -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])
|
||||
|
Loading…
Reference in New Issue
Block a user
У тебя в returning type указано
Optional[ListEvent]
, а возвращаешь тыAllListEventResponse