mirror of
https://github.com/bringout/oca-technical.git
synced 2026-04-18 03:12:04 +02:00
19 lines
676 B
Python
19 lines
676 B
Python
from typing import Annotated, Generic, TypeVar
|
|
|
|
from extendable_pydantic import StrictExtendableBaseModel
|
|
|
|
from pydantic import Field
|
|
|
|
T = TypeVar("T")
|
|
|
|
|
|
class PagedCollection(StrictExtendableBaseModel, Generic[T]):
|
|
"""A paged collection of items"""
|
|
|
|
# This is a generic model. The type of the items is defined by the generic type T.
|
|
# It provides you a common way to return a paged collection of items of
|
|
# extendable models. It's based on the StrictExtendableBaseModel to ensure
|
|
# a strict validation when used within the odoo fastapi framework.
|
|
|
|
count: Annotated[int, Field(..., description="The count of items into the system")]
|
|
items: list[T]
|