sponsors¶
Sponsors domain.
- class Sponsor[source]¶
Bases:
AuditBase,ContentManageableMixin,NameSlugMixin- __init__(**kwargs)¶
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
- created: Mapped[datetime]¶
- created_at: Mapped[datetime.datetime]¶
Date/time of instance creation.
- creator¶
- creator_id¶
- id: Mapped[UUID]¶
UUID Primary key column.
- last_modified_by¶
- last_modified_by_id¶
- name: Mapped[str]¶
- slug: Mapped[str]¶
- property tier: str¶
Get the tier name from the sponsor’s active sponsorship.
Returns the level slug from the first finalized sponsorship, or ‘community’ as a default if no active sponsorship exists.
- updated: Mapped[datetime]¶
- updated_at: Mapped[datetime.datetime]¶
Date/time of instance last update.
- class SponsorApplicationCreate[source]¶
Bases:
BaseModelSchema for sponsor application form submission.
- model_config: ClassVar[ConfigDict] = {'json_schema_extra': {'example': {'company_name': 'Acme Corp', 'contact_email': 'jane@acme.com', 'contact_name': 'Jane Doe', 'description': 'We love Python!', 'sponsorship_level': 'silver', 'website': 'https://acme.com'}}}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class SponsorController[source]¶
Bases:
ControllerController for Sponsor CRUD operations.
- after_request: AfterRequestHookHandler | None¶
A sync or async function executed before a
Requestis passed to any route handler.If this function returns a value, the request will not reach the route handler, and instead this value will be used.
- after_response: AfterResponseHookHandler | None¶
A sync or async function called after the response has been awaited.
It receives the
Requestinstance and should not return any values.
- before_request: BeforeRequestHookHandler | None¶
A sync or async function called immediately before calling the route handler.
It receives the
Requestinstance and any non-Nonereturn value is used for the response, bypassing the route handler.
- cache_control: CacheControlHeader | None¶
A
CacheControlHeaderheader to add to route handlers of this controller.Can be overridden by route handlers.
- dependencies: Dependencies | None¶
A string keyed dictionary of dependency
Providerinstances.
- dto: type[AbstractDTO] | None | EmptyType¶
AbstractDTOto use for (de)serializing and validation of request data.
- etag: ETag | None¶
An
etagheader of typeETagto add to route handlers of this controller.Can be overridden by route handlers.
- exception_handlers: ExceptionHandlersMap | None¶
A map of handler functions to status codes and/or exception types.
- guards: Sequence[Guard] | None¶
A sequence of
Guardcallables.
- include_in_schema: bool | EmptyType¶
A boolean flag dictating whether the route handler should be documented in the OpenAPI schema
- middleware: Sequence[Middleware] | None¶
A sequence of
Middleware.
- opt: Mapping[str, Any] | None¶
A string key mapping of arbitrary values that can be accessed in
Guardsor wherever you have access toRequestorASGI Scope.
- owner: Router¶
The
RouterorLitestarapp that owns the controller.This value is set internally by Litestar and it should not be set when subclassing the controller.
- parameters: ParametersMap | None¶
A mapping of
Parameterdefinitions available to all application paths.
- path: str¶
A path fragment for the controller.
All route handlers under the controller will have the fragment appended to them. If not set it defaults to
/.
- request_class: type[Request] | None¶
A custom subclass of
Requestto be used as the default request for all route handlers under the controller.
- request_max_body_size: int | None | EmptyType¶
Maximum allowed size of the request body in bytes. If this size is exceeded, a ‘413 - Request Entity Too Large’ error response is returned.
- response_class: type[Response] | None¶
A custom subclass of
Responseto be used as the default response for all route handlers under the controller.
- response_cookies: ResponseCookies | None¶
A list of
Cookieinstances.
- response_headers: ResponseHeaders | None¶
A string keyed dictionary mapping
ResponseHeaderinstances.
- return_dto: type[AbstractDTO] | None | EmptyType¶
AbstractDTOto use for serializing outbound response data.
- security: Sequence[SecurityRequirement] | None¶
A sequence of dictionaries that to the schema of all route handlers under the controller.
- signature_namespace: dict[str, Any]¶
A mapping of names to types for use in forward reference resolution during signature modelling.
- signature_types: Sequence[Any]¶
A sequence of types for use in forward reference resolution during signature modelling.
These types will be added to the signature namespace using their
__name__attribute.
- tags: Sequence[str] | None¶
A sequence of string tags that will be appended to the schema of all route handlers under the controller.
- type_decoders: TypeDecodersSequence | None¶
A sequence of tuples, each composed of a predicate testing for type identity and a msgspec hook for deserialization.
- type_encoders: TypeEncodersMap | None¶
A mapping of types to callables that transform them into types supported for serialization.
- websocket_class: type[WebSocket] | None¶
A custom subclass of
WebSocketto be used as the default websocket for all route handlers under the controller.
- class SponsorCreate[source]¶
Bases:
BaseModelSchema for creating a new sponsor.
- model_config: ClassVar[ConfigDict] = {'json_schema_extra': {'example': {'city': 'Redmond', 'country': 'USA', 'description': 'Microsoft is a Visionary sponsor of the PSF', 'landing_page_url': 'https://microsoft.com', 'linked_in_page_url': 'https://linkedin.com/company/microsoft', 'name': 'Microsoft', 'postal_code': '98052', 'slug': 'microsoft', 'state': 'Washington', 'twitter_handle': 'Microsoft', 'web_logo': '/media/sponsors/microsoft-logo.png'}}}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class SponsorPublic[source]¶
Bases:
BaseModelPublic sponsor schema.
- model_config: ClassVar[ConfigDict] = {'from_attributes': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class SponsorRead[source]¶
Bases:
SponsorBaseSchema for reading sponsor data.
- model_config: ClassVar[ConfigDict] = {'from_attributes': True, 'json_schema_extra': {'example': {'city': 'Redmond', 'country': 'USA', 'country_of_incorporation': '', 'created': '2025-01-01T00:00:00Z', 'creator_id': '550e8400-e29b-41d4-a716-446655440000', 'description': 'Microsoft is a Visionary sponsor of the PSF', 'id': '550e8400-e29b-41d4-a716-446655440010', 'landing_page_url': 'https://microsoft.com', 'last_modified_by_id': None, 'linked_in_page_url': 'https://linkedin.com/company/microsoft', 'mailing_address_line_1': '', 'mailing_address_line_2': '', 'name': 'Microsoft', 'postal_code': '98052', 'primary_phone': '', 'print_logo': '', 'slug': 'microsoft', 'state': 'Washington', 'state_of_incorporation': '', 'twitter_handle': 'Microsoft', 'updated': '2025-01-01T00:00:00Z', 'web_logo': '/media/sponsors/microsoft-logo.png'}}}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class SponsorRenderController[source]¶
Bases:
ControllerController for rendering sponsor pages as HTML.
- after_request: AfterRequestHookHandler | None¶
A sync or async function executed before a
Requestis passed to any route handler.If this function returns a value, the request will not reach the route handler, and instead this value will be used.
- after_response: AfterResponseHookHandler | None¶
A sync or async function called after the response has been awaited.
It receives the
Requestinstance and should not return any values.
- before_request: BeforeRequestHookHandler | None¶
A sync or async function called immediately before calling the route handler.
It receives the
Requestinstance and any non-Nonereturn value is used for the response, bypassing the route handler.
- cache_control: CacheControlHeader | None¶
A
CacheControlHeaderheader to add to route handlers of this controller.Can be overridden by route handlers.
- dependencies: Dependencies | None¶
A string keyed dictionary of dependency
Providerinstances.
- dto: type[AbstractDTO] | None | EmptyType¶
AbstractDTOto use for (de)serializing and validation of request data.
- etag: ETag | None¶
An
etagheader of typeETagto add to route handlers of this controller.Can be overridden by route handlers.
- exception_handlers: ExceptionHandlersMap | None¶
A map of handler functions to status codes and/or exception types.
- guards: Sequence[Guard] | None¶
A sequence of
Guardcallables.
- include_in_schema: bool | EmptyType¶
A boolean flag dictating whether the route handler should be documented in the OpenAPI schema
- middleware: Sequence[Middleware] | None¶
A sequence of
Middleware.
- opt: Mapping[str, Any] | None¶
A string key mapping of arbitrary values that can be accessed in
Guardsor wherever you have access toRequestorASGI Scope.
- owner: Router¶
The
RouterorLitestarapp that owns the controller.This value is set internally by Litestar and it should not be set when subclassing the controller.
- parameters: ParametersMap | None¶
A mapping of
Parameterdefinitions available to all application paths.
- path: str¶
A path fragment for the controller.
All route handlers under the controller will have the fragment appended to them. If not set it defaults to
/.
- request_class: type[Request] | None¶
A custom subclass of
Requestto be used as the default request for all route handlers under the controller.
- request_max_body_size: int | None | EmptyType¶
Maximum allowed size of the request body in bytes. If this size is exceeded, a ‘413 - Request Entity Too Large’ error response is returned.
- response_class: type[Response] | None¶
A custom subclass of
Responseto be used as the default response for all route handlers under the controller.
- response_cookies: ResponseCookies | None¶
A list of
Cookieinstances.
- response_headers: ResponseHeaders | None¶
A string keyed dictionary mapping
ResponseHeaderinstances.
- return_dto: type[AbstractDTO] | None | EmptyType¶
AbstractDTOto use for serializing outbound response data.
- security: Sequence[SecurityRequirement] | None¶
A sequence of dictionaries that to the schema of all route handlers under the controller.
- signature_namespace: dict[str, Any]¶
A mapping of names to types for use in forward reference resolution during signature modelling.
- signature_types: Sequence[Any]¶
A sequence of types for use in forward reference resolution during signature modelling.
These types will be added to the signature namespace using their
__name__attribute.
- tags: Sequence[str] | None¶
A sequence of string tags that will be appended to the schema of all route handlers under the controller.
- type_decoders: TypeDecodersSequence | None¶
A sequence of tuples, each composed of a predicate testing for type identity and a msgspec hook for deserialization.
- type_encoders: TypeEncodersMap | None¶
A mapping of types to callables that transform them into types supported for serialization.
- websocket_class: type[WebSocket] | None¶
A custom subclass of
WebSocketto be used as the default websocket for all route handlers under the controller.
- class SponsorRepository[source]¶
Bases:
SQLAlchemyAsyncRepository[Sponsor]Repository for Sponsor database operations.
- class SponsorService[source]¶
Bases:
SQLAlchemyAsyncRepositoryService[Sponsor, Any]Service for Sponsor business logic.
- async create_sponsor(data)[source]¶
Create a new sponsor.
- Parameters:
data (
SponsorCreate) – Sponsor creation data.- Return type:
- Returns:
The created sponsor instance.
- Raises:
ValueError – If slug already exists.
- async list_with_active_sponsorships(limit=100, offset=0)[source]¶
List sponsors with active sponsorships.
- match_fields: ClassVar[Optional[Union[list[str], str]]] = ['slug']¶
List of dialects that prefer to use
field.id = ANY(:1)instead offield.id IN (...).
- repository_type¶
alias of
SponsorRepository
- class SponsorUpdate[source]¶
Bases:
BaseModelSchema for updating a sponsor.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class Sponsorship[source]¶
Bases:
AuditBase,ContentManageableMixin- __init__(**kwargs)¶
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
- created: Mapped[datetime]¶
- created_at: Mapped[datetime.datetime]¶
Date/time of instance creation.
- creator¶
- creator_id¶
- id: Mapped[UUID]¶
UUID Primary key column.
- last_modified_by¶
- last_modified_by_id¶
- updated: Mapped[datetime]¶
- updated_at: Mapped[datetime.datetime]¶
Date/time of instance last update.
- class SponsorshipController[source]¶
Bases:
ControllerController for Sponsorship CRUD operations.
- after_request: AfterRequestHookHandler | None¶
A sync or async function executed before a
Requestis passed to any route handler.If this function returns a value, the request will not reach the route handler, and instead this value will be used.
- after_response: AfterResponseHookHandler | None¶
A sync or async function called after the response has been awaited.
It receives the
Requestinstance and should not return any values.
- before_request: BeforeRequestHookHandler | None¶
A sync or async function called immediately before calling the route handler.
It receives the
Requestinstance and any non-Nonereturn value is used for the response, bypassing the route handler.
- cache_control: CacheControlHeader | None¶
A
CacheControlHeaderheader to add to route handlers of this controller.Can be overridden by route handlers.
- dependencies: Dependencies | None¶
A string keyed dictionary of dependency
Providerinstances.
- dto: type[AbstractDTO] | None | EmptyType¶
AbstractDTOto use for (de)serializing and validation of request data.
- etag: ETag | None¶
An
etagheader of typeETagto add to route handlers of this controller.Can be overridden by route handlers.
- exception_handlers: ExceptionHandlersMap | None¶
A map of handler functions to status codes and/or exception types.
- guards: Sequence[Guard] | None¶
A sequence of
Guardcallables.
- include_in_schema: bool | EmptyType¶
A boolean flag dictating whether the route handler should be documented in the OpenAPI schema
- middleware: Sequence[Middleware] | None¶
A sequence of
Middleware.
- opt: Mapping[str, Any] | None¶
A string key mapping of arbitrary values that can be accessed in
Guardsor wherever you have access toRequestorASGI Scope.
- owner: Router¶
The
RouterorLitestarapp that owns the controller.This value is set internally by Litestar and it should not be set when subclassing the controller.
- parameters: ParametersMap | None¶
A mapping of
Parameterdefinitions available to all application paths.
- path: str¶
A path fragment for the controller.
All route handlers under the controller will have the fragment appended to them. If not set it defaults to
/.
- request_class: type[Request] | None¶
A custom subclass of
Requestto be used as the default request for all route handlers under the controller.
- request_max_body_size: int | None | EmptyType¶
Maximum allowed size of the request body in bytes. If this size is exceeded, a ‘413 - Request Entity Too Large’ error response is returned.
- response_class: type[Response] | None¶
A custom subclass of
Responseto be used as the default response for all route handlers under the controller.
- response_cookies: ResponseCookies | None¶
A list of
Cookieinstances.
- response_headers: ResponseHeaders | None¶
A string keyed dictionary mapping
ResponseHeaderinstances.
- return_dto: type[AbstractDTO] | None | EmptyType¶
AbstractDTOto use for serializing outbound response data.
- security: Sequence[SecurityRequirement] | None¶
A sequence of dictionaries that to the schema of all route handlers under the controller.
- signature_namespace: dict[str, Any]¶
A mapping of names to types for use in forward reference resolution during signature modelling.
- signature_types: Sequence[Any]¶
A sequence of types for use in forward reference resolution during signature modelling.
These types will be added to the signature namespace using their
__name__attribute.
- tags: Sequence[str] | None¶
A sequence of string tags that will be appended to the schema of all route handlers under the controller.
- type_decoders: TypeDecodersSequence | None¶
A sequence of tuples, each composed of a predicate testing for type identity and a msgspec hook for deserialization.
- type_encoders: TypeEncodersMap | None¶
A mapping of types to callables that transform them into types supported for serialization.
- websocket_class: type[WebSocket] | None¶
A custom subclass of
WebSocketto be used as the default websocket for all route handlers under the controller.
- class SponsorshipCreate[source]¶
Bases:
BaseModelSchema for creating a new sponsorship.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class SponsorshipLevel[source]¶
Bases:
AuditBase,NameSlugMixin- __init__(**kwargs)¶
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
- created_at: Mapped[datetime.datetime]¶
Date/time of instance creation.
- id: Mapped[UUID]¶
UUID Primary key column.
- name: Mapped[str]¶
- slug: Mapped[str]¶
- updated_at: Mapped[datetime.datetime]¶
Date/time of instance last update.
- class SponsorshipLevelController[source]¶
Bases:
ControllerController for SponsorshipLevel CRUD operations.
- after_request: AfterRequestHookHandler | None¶
A sync or async function executed before a
Requestis passed to any route handler.If this function returns a value, the request will not reach the route handler, and instead this value will be used.
- after_response: AfterResponseHookHandler | None¶
A sync or async function called after the response has been awaited.
It receives the
Requestinstance and should not return any values.
- before_request: BeforeRequestHookHandler | None¶
A sync or async function called immediately before calling the route handler.
It receives the
Requestinstance and any non-Nonereturn value is used for the response, bypassing the route handler.
- cache_control: CacheControlHeader | None¶
A
CacheControlHeaderheader to add to route handlers of this controller.Can be overridden by route handlers.
- dependencies: Dependencies | None¶
A string keyed dictionary of dependency
Providerinstances.
- dto: type[AbstractDTO] | None | EmptyType¶
AbstractDTOto use for (de)serializing and validation of request data.
- etag: ETag | None¶
An
etagheader of typeETagto add to route handlers of this controller.Can be overridden by route handlers.
- exception_handlers: ExceptionHandlersMap | None¶
A map of handler functions to status codes and/or exception types.
- guards: Sequence[Guard] | None¶
A sequence of
Guardcallables.
- include_in_schema: bool | EmptyType¶
A boolean flag dictating whether the route handler should be documented in the OpenAPI schema
- middleware: Sequence[Middleware] | None¶
A sequence of
Middleware.
- opt: Mapping[str, Any] | None¶
A string key mapping of arbitrary values that can be accessed in
Guardsor wherever you have access toRequestorASGI Scope.
- owner: Router¶
The
RouterorLitestarapp that owns the controller.This value is set internally by Litestar and it should not be set when subclassing the controller.
- parameters: ParametersMap | None¶
A mapping of
Parameterdefinitions available to all application paths.
- path: str¶
A path fragment for the controller.
All route handlers under the controller will have the fragment appended to them. If not set it defaults to
/.
- request_class: type[Request] | None¶
A custom subclass of
Requestto be used as the default request for all route handlers under the controller.
- request_max_body_size: int | None | EmptyType¶
Maximum allowed size of the request body in bytes. If this size is exceeded, a ‘413 - Request Entity Too Large’ error response is returned.
- response_class: type[Response] | None¶
A custom subclass of
Responseto be used as the default response for all route handlers under the controller.
- response_cookies: ResponseCookies | None¶
A list of
Cookieinstances.
- response_headers: ResponseHeaders | None¶
A string keyed dictionary mapping
ResponseHeaderinstances.
- return_dto: type[AbstractDTO] | None | EmptyType¶
AbstractDTOto use for serializing outbound response data.
- security: Sequence[SecurityRequirement] | None¶
A sequence of dictionaries that to the schema of all route handlers under the controller.
- signature_namespace: dict[str, Any]¶
A mapping of names to types for use in forward reference resolution during signature modelling.
- signature_types: Sequence[Any]¶
A sequence of types for use in forward reference resolution during signature modelling.
These types will be added to the signature namespace using their
__name__attribute.
- tags: Sequence[str] | None¶
A sequence of string tags that will be appended to the schema of all route handlers under the controller.
- type_decoders: TypeDecodersSequence | None¶
A sequence of tuples, each composed of a predicate testing for type identity and a msgspec hook for deserialization.
- type_encoders: TypeEncodersMap | None¶
A mapping of types to callables that transform them into types supported for serialization.
- websocket_class: type[WebSocket] | None¶
A custom subclass of
WebSocketto be used as the default websocket for all route handlers under the controller.
- class SponsorshipLevelCreate[source]¶
Bases:
BaseModelSchema for creating a new sponsorship level.
- model_config: ClassVar[ConfigDict] = {'json_schema_extra': {'example': {'logo_dimension': 200, 'name': 'Visionary', 'order': 1, 'slug': 'visionary', 'sponsorship_amount': 150000}}}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class SponsorshipLevelRead[source]¶
Bases:
SponsorshipLevelBaseSchema for reading sponsorship level data.
- model_config: ClassVar[ConfigDict] = {'from_attributes': True, 'json_schema_extra': {'example': {'created_at': '2025-01-01T00:00:00Z', 'id': '550e8400-e29b-41d4-a716-446655440001', 'logo_dimension': 200, 'name': 'Visionary', 'order': 1, 'slug': 'visionary', 'sponsorship_amount': 150000, 'updated_at': '2025-01-01T00:00:00Z'}}}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class SponsorshipLevelRepository[source]¶
Bases:
SQLAlchemyAsyncRepository[SponsorshipLevel]Repository for SponsorshipLevel database operations.
- async get_by_slug(slug)[source]¶
Get a sponsorship level by its slug.
- Parameters:
slug (
str) – The slug to search for.- Return type:
- Returns:
The sponsorship level if found, None otherwise.
- async list_ordered(limit=100, offset=0)[source]¶
List sponsorship levels ordered by order field.
- Parameters:
- Return type:
- Returns:
List of sponsorship levels ordered by order field.
- model_type¶
alias of
SponsorshipLevel
- class SponsorshipLevelService[source]¶
Bases:
SQLAlchemyAsyncRepositoryService[SponsorshipLevel, Any]Service for SponsorshipLevel business logic.
- async create_level(data)[source]¶
Create a new sponsorship level.
- Parameters:
data (
SponsorshipLevelCreate) – Sponsorship level creation data.- Return type:
- Returns:
The created sponsorship level instance.
- Raises:
ValueError – If slug already exists.
- async get_by_slug(slug)[source]¶
Get a sponsorship level by its slug.
- Parameters:
slug (
str) – The slug to search for.- Return type:
- Returns:
The sponsorship level if found, None otherwise.
- async list_ordered(limit=100, offset=0)[source]¶
List sponsorship levels ordered by order field.
- Parameters:
- Return type:
- Returns:
List of sponsorship levels ordered by order field.
- match_fields: ClassVar[Optional[Union[list[str], str]]] = ['slug']¶
List of dialects that prefer to use
field.id = ANY(:1)instead offield.id IN (...).
- repository_type¶
alias of
SponsorshipLevelRepository
- class SponsorshipLevelUpdate[source]¶
Bases:
BaseModelSchema for updating a sponsorship level.
- model_config: ClassVar[ConfigDict] = {'json_schema_extra': {'example': {'logo_dimension': 250, 'sponsorship_amount': 175000}}}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class SponsorshipPublic[source]¶
Bases:
BaseModelPublic sponsorship schema.
- model_config: ClassVar[ConfigDict] = {'from_attributes': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class SponsorshipRead[source]¶
Bases:
SponsorshipBaseSchema for reading sponsorship data.
- model_config: ClassVar[ConfigDict] = {'from_attributes': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class SponsorshipRepository[source]¶
Bases:
SQLAlchemyAsyncRepository[Sponsorship]Repository for Sponsorship database operations.
- async get_previous_for_sponsor(sponsor_id, current_year)[source]¶
Get the previous sponsorship for a sponsor.
- Parameters:
- Return type:
- Returns:
The previous sponsorship if found, None otherwise.
- async list_active(limit=100, offset=0)[source]¶
List active sponsorships.
- Parameters:
- Return type:
- Returns:
List of active sponsorships.
- async list_by_level_id(level_id, limit=100, offset=0)[source]¶
List sponsorships for a specific level.
- Parameters:
- Return type:
- Returns:
List of sponsorships for the level.
- async list_by_sponsor_id(sponsor_id, limit=100, offset=0)[source]¶
List sponsorships for a specific sponsor.
- Parameters:
- Return type:
- Returns:
List of sponsorships for the sponsor.
- async list_by_status(status, limit=100, offset=0)[source]¶
List sponsorships by status.
- Parameters:
status (
SponsorshipStatus) – The status to filter by.limit (
int) – Maximum number of sponsorships to return.offset (
int) – Number of sponsorships to skip.
- Return type:
- Returns:
List of sponsorships with the given status.
- async list_expiring_soon(days=90, limit=100, offset=0)[source]¶
List sponsorships expiring within the given number of days.
- Parameters:
- Return type:
- Returns:
List of sponsorships expiring within the given timeframe.
- model_type¶
alias of
Sponsorship
- class SponsorshipService[source]¶
Bases:
SQLAlchemyAsyncRepositoryService[Sponsorship, Any]Service for Sponsorship business logic.
- async approve(sponsorship_id)[source]¶
Approve a sponsorship.
- Parameters:
sponsorship_id (
UUID) – The ID of the sponsorship to approve.- Return type:
- Returns:
The updated sponsorship instance.
- async approve_with_renewal(sponsorship_id, start_date, end_date, sponsorship_fee=None, *, is_renewal=False)[source]¶
Approve a sponsorship with full approval data.
- Parameters:
- Return type:
- Returns:
The updated sponsorship instance.
- async create_renewal(previous_sponsorship, level_id=None)[source]¶
Create a renewal sponsorship based on a previous one.
- Parameters:
previous_sponsorship (
Sponsorship) – The sponsorship being renewed.level_id (
UUID|None) – Optional new level ID (defaults to same level).
- Return type:
- Returns:
The new renewal sponsorship instance.
- async create_sponsorship(data)[source]¶
Create a new sponsorship.
- Parameters:
data (
SponsorshipCreate) – Sponsorship creation data.- Return type:
- Returns:
The created sponsorship instance.
- async finalize(sponsorship_id)[source]¶
Finalize a sponsorship.
- Parameters:
sponsorship_id (
UUID) – The ID of the sponsorship to finalize.- Return type:
- Returns:
The updated sponsorship instance.
- async get_previous_sponsorship(sponsorship)[source]¶
Get the previous sponsorship for the same sponsor.
Used to determine previous effective date for renewal contracts.
- Parameters:
sponsorship (
Sponsorship) – The current sponsorship.- Return type:
- Returns:
The previous sponsorship if found, None otherwise.
- async list_active(limit=100, offset=0)[source]¶
List active sponsorships.
- Parameters:
- Return type:
- Returns:
List of active sponsorships.
- async list_by_level_id(level_id, limit=100, offset=0)[source]¶
List sponsorships for a specific level.
- Parameters:
- Return type:
- Returns:
List of sponsorships for the level.
- async list_by_sponsor_id(sponsor_id, limit=100, offset=0)[source]¶
List sponsorships for a specific sponsor.
- Parameters:
- Return type:
- Returns:
List of sponsorships for the sponsor.
- async list_by_status(status, limit=100, offset=0)[source]¶
List sponsorships by status.
- Parameters:
status (
SponsorshipStatus) – The status to filter by.limit (
int) – Maximum number of sponsorships to return.offset (
int) – Number of sponsorships to skip.
- Return type:
- Returns:
List of sponsorships with the given status.
- async list_expiring_soon(days=90, limit=100, offset=0)[source]¶
List sponsorships expiring within the given number of days.
Useful for sending renewal reminders.
- Parameters:
- Return type:
- Returns:
List of sponsorships expiring within the given timeframe.
- match_fields: ClassVar[Optional[Union[list[str], str]]] = ['sponsor_id', 'level_id']¶
List of dialects that prefer to use
field.id = ANY(:1)instead offield.id IN (...).
- async reject(sponsorship_id)[source]¶
Reject a sponsorship.
- Parameters:
sponsorship_id (
UUID) – The ID of the sponsorship to reject.- Return type:
- Returns:
The updated sponsorship instance.
- repository_type¶
alias of
SponsorshipRepository
- class SponsorshipUpdate[source]¶
Bases:
BaseModelSchema for updating a sponsorship.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
models¶
Sponsors domain models.
- class SponsorshipLevel[source]¶
Bases:
AuditBase,NameSlugMixin- __init__(**kwargs)¶
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
- created_at: Mapped[datetime.datetime]¶
Date/time of instance creation.
- id: Mapped[UUID]¶
UUID Primary key column.
- name: Mapped[str]¶
- slug: Mapped[str]¶
- updated_at: Mapped[datetime.datetime]¶
Date/time of instance last update.
- class Sponsor[source]¶
Bases:
AuditBase,ContentManageableMixin,NameSlugMixin- property tier: str¶
Get the tier name from the sponsor’s active sponsorship.
Returns the level slug from the first finalized sponsorship, or ‘community’ as a default if no active sponsorship exists.
- __init__(**kwargs)¶
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
- created: Mapped[datetime]¶
- created_at: Mapped[datetime.datetime]¶
Date/time of instance creation.
- creator¶
- creator_id¶
- id: Mapped[UUID]¶
UUID Primary key column.
- last_modified_by¶
- last_modified_by_id¶
- name: Mapped[str]¶
- slug: Mapped[str]¶
- updated: Mapped[datetime]¶
- updated_at: Mapped[datetime.datetime]¶
Date/time of instance last update.
- class Sponsorship[source]¶
Bases:
AuditBase,ContentManageableMixin- __init__(**kwargs)¶
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
- created: Mapped[datetime]¶
- created_at: Mapped[datetime.datetime]¶
Date/time of instance creation.
- creator¶
- creator_id¶
- id: Mapped[UUID]¶
UUID Primary key column.
- last_modified_by¶
- last_modified_by_id¶
- updated: Mapped[datetime]¶
- updated_at: Mapped[datetime.datetime]¶
Date/time of instance last update.
- class LegalClause[source]¶
Bases:
Base,NameSlugMixinLegal clauses applied to sponsor contracts.
Clauses define terms and conditions that can be attached to contracts.
- __init__(**kwargs)¶
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
- id: Mapped[UUID]¶
UUID Primary key column.
- name: Mapped[str]¶
- slug: Mapped[str]¶
- class Contract[source]¶
Bases:
AuditBaseContract for officializing a sponsorship.
Tracks the contract document lifecycle from draft through execution.
- property next_statuses: list[ContractStatus]¶
Get valid next statuses for current state.
- __init__(**kwargs)¶
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
- created_at: Mapped[datetime.datetime]¶
Date/time of instance creation.
- id: Mapped[UUID]¶
UUID Primary key column.
- updated_at: Mapped[datetime.datetime]¶
Date/time of instance last update.
schemas¶
Sponsors domain Pydantic schemas.
- class SponsorshipLevelBase[source]¶
Bases:
BaseModelBase sponsorship level schema.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class SponsorshipLevelCreate[source]¶
Bases:
BaseModelSchema for creating a new sponsorship level.
- model_config: ClassVar[ConfigDict] = {'json_schema_extra': {'example': {'logo_dimension': 200, 'name': 'Visionary', 'order': 1, 'slug': 'visionary', 'sponsorship_amount': 150000}}}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class SponsorshipLevelUpdate[source]¶
Bases:
BaseModelSchema for updating a sponsorship level.
- model_config: ClassVar[ConfigDict] = {'json_schema_extra': {'example': {'logo_dimension': 250, 'sponsorship_amount': 175000}}}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class SponsorshipLevelRead[source]¶
Bases:
SponsorshipLevelBaseSchema for reading sponsorship level data.
- model_config: ClassVar[ConfigDict] = {'from_attributes': True, 'json_schema_extra': {'example': {'created_at': '2025-01-01T00:00:00Z', 'id': '550e8400-e29b-41d4-a716-446655440001', 'logo_dimension': 200, 'name': 'Visionary', 'order': 1, 'slug': 'visionary', 'sponsorship_amount': 150000, 'updated_at': '2025-01-01T00:00:00Z'}}}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class SponsorBase[source]¶
Bases:
BaseModelBase sponsor schema.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class SponsorCreate[source]¶
Bases:
BaseModelSchema for creating a new sponsor.
- model_config: ClassVar[ConfigDict] = {'json_schema_extra': {'example': {'city': 'Redmond', 'country': 'USA', 'description': 'Microsoft is a Visionary sponsor of the PSF', 'landing_page_url': 'https://microsoft.com', 'linked_in_page_url': 'https://linkedin.com/company/microsoft', 'name': 'Microsoft', 'postal_code': '98052', 'slug': 'microsoft', 'state': 'Washington', 'twitter_handle': 'Microsoft', 'web_logo': '/media/sponsors/microsoft-logo.png'}}}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class SponsorUpdate[source]¶
Bases:
BaseModelSchema for updating a sponsor.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class SponsorRead[source]¶
Bases:
SponsorBaseSchema for reading sponsor data.
- model_config: ClassVar[ConfigDict] = {'from_attributes': True, 'json_schema_extra': {'example': {'city': 'Redmond', 'country': 'USA', 'country_of_incorporation': '', 'created': '2025-01-01T00:00:00Z', 'creator_id': '550e8400-e29b-41d4-a716-446655440000', 'description': 'Microsoft is a Visionary sponsor of the PSF', 'id': '550e8400-e29b-41d4-a716-446655440010', 'landing_page_url': 'https://microsoft.com', 'last_modified_by_id': None, 'linked_in_page_url': 'https://linkedin.com/company/microsoft', 'mailing_address_line_1': '', 'mailing_address_line_2': '', 'name': 'Microsoft', 'postal_code': '98052', 'primary_phone': '', 'print_logo': '', 'slug': 'microsoft', 'state': 'Washington', 'state_of_incorporation': '', 'twitter_handle': 'Microsoft', 'updated': '2025-01-01T00:00:00Z', 'web_logo': '/media/sponsors/microsoft-logo.png'}}}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class SponsorPublic[source]¶
Bases:
BaseModelPublic sponsor schema.
- model_config: ClassVar[ConfigDict] = {'from_attributes': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class SponsorshipBase[source]¶
Bases:
BaseModelBase sponsorship schema.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class SponsorshipCreate[source]¶
Bases:
BaseModelSchema for creating a new sponsorship.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class SponsorshipUpdate[source]¶
Bases:
BaseModelSchema for updating a sponsorship.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class SponsorshipRead[source]¶
Bases:
SponsorshipBaseSchema for reading sponsorship data.
- model_config: ClassVar[ConfigDict] = {'from_attributes': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class SponsorshipPublic[source]¶
Bases:
BaseModelPublic sponsorship schema.
- model_config: ClassVar[ConfigDict] = {'from_attributes': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class SponsorApplicationCreate[source]¶
Bases:
BaseModelSchema for sponsor application form submission.
- model_config: ClassVar[ConfigDict] = {'json_schema_extra': {'example': {'company_name': 'Acme Corp', 'contact_email': 'jane@acme.com', 'contact_name': 'Jane Doe', 'description': 'We love Python!', 'sponsorship_level': 'silver', 'website': 'https://acme.com'}}}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
services¶
Sponsors domain services for business logic.
- exception InvalidContractStatusError[source]¶
Bases:
ExceptionRaised when a contract status transition is not valid.
- class SponsorshipLevelService[source]¶
Bases:
SQLAlchemyAsyncRepositoryService[SponsorshipLevel, Any]Service for SponsorshipLevel business logic.
- repository_type¶
alias of
SponsorshipLevelRepository
- match_fields: ClassVar[Optional[Union[list[str], str]]] = ['slug']¶
List of dialects that prefer to use
field.id = ANY(:1)instead offield.id IN (...).
- async create_level(data)[source]¶
Create a new sponsorship level.
- Parameters:
data (
SponsorshipLevelCreate) – Sponsorship level creation data.- Return type:
- Returns:
The created sponsorship level instance.
- Raises:
ValueError – If slug already exists.
- class SponsorService[source]¶
Bases:
SQLAlchemyAsyncRepositoryService[Sponsor, Any]Service for Sponsor business logic.
- repository_type¶
alias of
SponsorRepository
- match_fields: ClassVar[Optional[Union[list[str], str]]] = ['slug']¶
List of dialects that prefer to use
field.id = ANY(:1)instead offield.id IN (...).
- async create_sponsor(data)[source]¶
Create a new sponsor.
- Parameters:
data (
SponsorCreate) – Sponsor creation data.- Return type:
- Returns:
The created sponsor instance.
- Raises:
ValueError – If slug already exists.
- class SponsorshipService[source]¶
Bases:
SQLAlchemyAsyncRepositoryService[Sponsorship, Any]Service for Sponsorship business logic.
- repository_type¶
alias of
SponsorshipRepository
- match_fields: ClassVar[Optional[Union[list[str], str]]] = ['sponsor_id', 'level_id']¶
List of dialects that prefer to use
field.id = ANY(:1)instead offield.id IN (...).
- async create_sponsorship(data)[source]¶
Create a new sponsorship.
- Parameters:
data (
SponsorshipCreate) – Sponsorship creation data.- Return type:
- Returns:
The created sponsorship instance.
- async list_by_sponsor_id(sponsor_id, limit=100, offset=0)[source]¶
List sponsorships for a specific sponsor.
- Parameters:
- Return type:
- Returns:
List of sponsorships for the sponsor.
- async list_by_level_id(level_id, limit=100, offset=0)[source]¶
List sponsorships for a specific level.
- Parameters:
- Return type:
- Returns:
List of sponsorships for the level.
- async list_by_status(status, limit=100, offset=0)[source]¶
List sponsorships by status.
- Parameters:
status (
SponsorshipStatus) – The status to filter by.limit (
int) – Maximum number of sponsorships to return.offset (
int) – Number of sponsorships to skip.
- Return type:
- Returns:
List of sponsorships with the given status.
- async list_active(limit=100, offset=0)[source]¶
List active sponsorships.
- Parameters:
- Return type:
- Returns:
List of active sponsorships.
- async approve(sponsorship_id)[source]¶
Approve a sponsorship.
- Parameters:
sponsorship_id (
UUID) – The ID of the sponsorship to approve.- Return type:
- Returns:
The updated sponsorship instance.
- async reject(sponsorship_id)[source]¶
Reject a sponsorship.
- Parameters:
sponsorship_id (
UUID) – The ID of the sponsorship to reject.- Return type:
- Returns:
The updated sponsorship instance.
- async finalize(sponsorship_id)[source]¶
Finalize a sponsorship.
- Parameters:
sponsorship_id (
UUID) – The ID of the sponsorship to finalize.- Return type:
- Returns:
The updated sponsorship instance.
- async approve_with_renewal(sponsorship_id, start_date, end_date, sponsorship_fee=None, *, is_renewal=False)[source]¶
Approve a sponsorship with full approval data.
- Parameters:
- Return type:
- Returns:
The updated sponsorship instance.
- async get_previous_sponsorship(sponsorship)[source]¶
Get the previous sponsorship for the same sponsor.
Used to determine previous effective date for renewal contracts.
- Parameters:
sponsorship (
Sponsorship) – The current sponsorship.- Return type:
- Returns:
The previous sponsorship if found, None otherwise.
- async list_expiring_soon(days=90, limit=100, offset=0)[source]¶
List sponsorships expiring within the given number of days.
Useful for sending renewal reminders.
- Parameters:
- Return type:
- Returns:
List of sponsorships expiring within the given timeframe.
- async create_renewal(previous_sponsorship, level_id=None)[source]¶
Create a renewal sponsorship based on a previous one.
- Parameters:
previous_sponsorship (
Sponsorship) – The sponsorship being renewed.level_id (
UUID|None) – Optional new level ID (defaults to same level).
- Return type:
- Returns:
The new renewal sponsorship instance.
- class LegalClauseService[source]¶
Bases:
SQLAlchemyAsyncRepositoryService[LegalClause, Any]Service for LegalClause business logic.
- repository_type¶
alias of
LegalClauseRepository
- match_fields: ClassVar[Optional[Union[list[str], str]]] = ['slug']¶
List of dialects that prefer to use
field.id = ANY(:1)instead offield.id IN (...).
- class ContractService[source]¶
Bases:
SQLAlchemyAsyncRepositoryService[Contract, Any]Service for Contract business logic and workflow management.
- repository_type¶
alias of
ContractRepository
- async create_contract(sponsorship_id)[source]¶
Create a new contract for a sponsorship.
Initializes a draft contract with sponsor information from the sponsorship.
- async list_by_status(status, limit=100, offset=0)[source]¶
List contracts by status.
- Parameters:
status (
ContractStatus) – The status to filter by.limit (
int) – Maximum number of contracts to return.offset (
int) – Number of contracts to skip.
- Return type:
- Returns:
List of contracts with the given status.
- async send_for_signature(contract_id, document_pdf='', document_docx='')[source]¶
Send contract for signature.
Transitions contract from DRAFT to AWAITING_SIGNATURE.
- Parameters:
- Return type:
- Returns:
The updated contract instance.
- Raises:
InvalidContractStatusError – If transition is not valid.
- async execute_contract(contract_id, signed_document='')[source]¶
Execute a contract.
Marks the contract as executed and finalizes the associated sponsorship.
- Parameters:
- Return type:
- Returns:
The updated contract instance.
- Raises:
InvalidContractStatusError – If transition is not valid.
- async nullify_contract(contract_id)[source]¶
Nullify a contract.
- Parameters:
contract_id (
UUID) – The contract ID.- Return type:
- Returns:
The updated contract instance.
- Raises:
InvalidContractStatusError – If transition is not valid.
- async revert_to_draft(contract_id)[source]¶
Revert a nullified contract back to draft.
- Parameters:
contract_id (
UUID) – The contract ID.- Return type:
- Returns:
The updated contract instance.
- Raises:
InvalidContractStatusError – If transition is not valid.
controllers¶
Sponsors domain API controllers.
- class SponsorshipLevelController[source]¶
Bases:
ControllerController for SponsorshipLevel CRUD operations.
- path: str¶
A path fragment for the controller.
All route handlers under the controller will have the fragment appended to them. If not set it defaults to
/.
- tags: Sequence[str] | None¶
A sequence of string tags that will be appended to the schema of all route handlers under the controller.
- after_request: AfterRequestHookHandler | None¶
A sync or async function executed before a
Requestis passed to any route handler.If this function returns a value, the request will not reach the route handler, and instead this value will be used.
- after_response: AfterResponseHookHandler | None¶
A sync or async function called after the response has been awaited.
It receives the
Requestinstance and should not return any values.
- before_request: BeforeRequestHookHandler | None¶
A sync or async function called immediately before calling the route handler.
It receives the
Requestinstance and any non-Nonereturn value is used for the response, bypassing the route handler.
- cache_control: CacheControlHeader | None¶
A
CacheControlHeaderheader to add to route handlers of this controller.Can be overridden by route handlers.
- dependencies: Dependencies | None¶
A string keyed dictionary of dependency
Providerinstances.
- dto: type[AbstractDTO] | None | EmptyType¶
AbstractDTOto use for (de)serializing and validation of request data.
- etag: ETag | None¶
An
etagheader of typeETagto add to route handlers of this controller.Can be overridden by route handlers.
- exception_handlers: ExceptionHandlersMap | None¶
A map of handler functions to status codes and/or exception types.
- guards: Sequence[Guard] | None¶
A sequence of
Guardcallables.
- include_in_schema: bool | EmptyType¶
A boolean flag dictating whether the route handler should be documented in the OpenAPI schema
- middleware: Sequence[Middleware] | None¶
A sequence of
Middleware.
- opt: Mapping[str, Any] | None¶
A string key mapping of arbitrary values that can be accessed in
Guardsor wherever you have access toRequestorASGI Scope.
- owner: Router¶
The
RouterorLitestarapp that owns the controller.This value is set internally by Litestar and it should not be set when subclassing the controller.
- parameters: ParametersMap | None¶
A mapping of
Parameterdefinitions available to all application paths.
- request_class: type[Request] | None¶
A custom subclass of
Requestto be used as the default request for all route handlers under the controller.
- request_max_body_size: int | None | EmptyType¶
Maximum allowed size of the request body in bytes. If this size is exceeded, a ‘413 - Request Entity Too Large’ error response is returned.
- response_class: type[Response] | None¶
A custom subclass of
Responseto be used as the default response for all route handlers under the controller.
- response_cookies: ResponseCookies | None¶
A list of
Cookieinstances.
- response_headers: ResponseHeaders | None¶
A string keyed dictionary mapping
ResponseHeaderinstances.
- return_dto: type[AbstractDTO] | None | EmptyType¶
AbstractDTOto use for serializing outbound response data.
- security: Sequence[SecurityRequirement] | None¶
A sequence of dictionaries that to the schema of all route handlers under the controller.
- signature_namespace: dict[str, Any]¶
A mapping of names to types for use in forward reference resolution during signature modelling.
- signature_types: Sequence[Any]¶
A sequence of types for use in forward reference resolution during signature modelling.
These types will be added to the signature namespace using their
__name__attribute.
- type_decoders: TypeDecodersSequence | None¶
A sequence of tuples, each composed of a predicate testing for type identity and a msgspec hook for deserialization.
- type_encoders: TypeEncodersMap | None¶
A mapping of types to callables that transform them into types supported for serialization.
- websocket_class: type[WebSocket] | None¶
A custom subclass of
WebSocketto be used as the default websocket for all route handlers under the controller.
- class SponsorController[source]¶
Bases:
ControllerController for Sponsor CRUD operations.
- path: str¶
A path fragment for the controller.
All route handlers under the controller will have the fragment appended to them. If not set it defaults to
/.
- tags: Sequence[str] | None¶
A sequence of string tags that will be appended to the schema of all route handlers under the controller.
- after_request: AfterRequestHookHandler | None¶
A sync or async function executed before a
Requestis passed to any route handler.If this function returns a value, the request will not reach the route handler, and instead this value will be used.
- after_response: AfterResponseHookHandler | None¶
A sync or async function called after the response has been awaited.
It receives the
Requestinstance and should not return any values.
- before_request: BeforeRequestHookHandler | None¶
A sync or async function called immediately before calling the route handler.
It receives the
Requestinstance and any non-Nonereturn value is used for the response, bypassing the route handler.
- cache_control: CacheControlHeader | None¶
A
CacheControlHeaderheader to add to route handlers of this controller.Can be overridden by route handlers.
- dependencies: Dependencies | None¶
A string keyed dictionary of dependency
Providerinstances.
- dto: type[AbstractDTO] | None | EmptyType¶
AbstractDTOto use for (de)serializing and validation of request data.
- etag: ETag | None¶
An
etagheader of typeETagto add to route handlers of this controller.Can be overridden by route handlers.
- exception_handlers: ExceptionHandlersMap | None¶
A map of handler functions to status codes and/or exception types.
- guards: Sequence[Guard] | None¶
A sequence of
Guardcallables.
- include_in_schema: bool | EmptyType¶
A boolean flag dictating whether the route handler should be documented in the OpenAPI schema
- middleware: Sequence[Middleware] | None¶
A sequence of
Middleware.
- opt: Mapping[str, Any] | None¶
A string key mapping of arbitrary values that can be accessed in
Guardsor wherever you have access toRequestorASGI Scope.
- owner: Router¶
The
RouterorLitestarapp that owns the controller.This value is set internally by Litestar and it should not be set when subclassing the controller.
- parameters: ParametersMap | None¶
A mapping of
Parameterdefinitions available to all application paths.
- request_class: type[Request] | None¶
A custom subclass of
Requestto be used as the default request for all route handlers under the controller.
- request_max_body_size: int | None | EmptyType¶
Maximum allowed size of the request body in bytes. If this size is exceeded, a ‘413 - Request Entity Too Large’ error response is returned.
- response_class: type[Response] | None¶
A custom subclass of
Responseto be used as the default response for all route handlers under the controller.
- response_cookies: ResponseCookies | None¶
A list of
Cookieinstances.
- response_headers: ResponseHeaders | None¶
A string keyed dictionary mapping
ResponseHeaderinstances.
- return_dto: type[AbstractDTO] | None | EmptyType¶
AbstractDTOto use for serializing outbound response data.
- security: Sequence[SecurityRequirement] | None¶
A sequence of dictionaries that to the schema of all route handlers under the controller.
- signature_namespace: dict[str, Any]¶
A mapping of names to types for use in forward reference resolution during signature modelling.
- signature_types: Sequence[Any]¶
A sequence of types for use in forward reference resolution during signature modelling.
These types will be added to the signature namespace using their
__name__attribute.
- type_decoders: TypeDecodersSequence | None¶
A sequence of tuples, each composed of a predicate testing for type identity and a msgspec hook for deserialization.
- type_encoders: TypeEncodersMap | None¶
A mapping of types to callables that transform them into types supported for serialization.
- websocket_class: type[WebSocket] | None¶
A custom subclass of
WebSocketto be used as the default websocket for all route handlers under the controller.
- class SponsorshipController[source]¶
Bases:
ControllerController for Sponsorship CRUD operations.
- path: str¶
A path fragment for the controller.
All route handlers under the controller will have the fragment appended to them. If not set it defaults to
/.
- tags: Sequence[str] | None¶
A sequence of string tags that will be appended to the schema of all route handlers under the controller.
- after_request: AfterRequestHookHandler | None¶
A sync or async function executed before a
Requestis passed to any route handler.If this function returns a value, the request will not reach the route handler, and instead this value will be used.
- after_response: AfterResponseHookHandler | None¶
A sync or async function called after the response has been awaited.
It receives the
Requestinstance and should not return any values.
- before_request: BeforeRequestHookHandler | None¶
A sync or async function called immediately before calling the route handler.
It receives the
Requestinstance and any non-Nonereturn value is used for the response, bypassing the route handler.
- cache_control: CacheControlHeader | None¶
A
CacheControlHeaderheader to add to route handlers of this controller.Can be overridden by route handlers.
- dependencies: Dependencies | None¶
A string keyed dictionary of dependency
Providerinstances.
- dto: type[AbstractDTO] | None | EmptyType¶
AbstractDTOto use for (de)serializing and validation of request data.
- etag: ETag | None¶
An
etagheader of typeETagto add to route handlers of this controller.Can be overridden by route handlers.
- exception_handlers: ExceptionHandlersMap | None¶
A map of handler functions to status codes and/or exception types.
- guards: Sequence[Guard] | None¶
A sequence of
Guardcallables.
- include_in_schema: bool | EmptyType¶
A boolean flag dictating whether the route handler should be documented in the OpenAPI schema
- middleware: Sequence[Middleware] | None¶
A sequence of
Middleware.
- opt: Mapping[str, Any] | None¶
A string key mapping of arbitrary values that can be accessed in
Guardsor wherever you have access toRequestorASGI Scope.
- owner: Router¶
The
RouterorLitestarapp that owns the controller.This value is set internally by Litestar and it should not be set when subclassing the controller.
- parameters: ParametersMap | None¶
A mapping of
Parameterdefinitions available to all application paths.
- request_class: type[Request] | None¶
A custom subclass of
Requestto be used as the default request for all route handlers under the controller.
- request_max_body_size: int | None | EmptyType¶
Maximum allowed size of the request body in bytes. If this size is exceeded, a ‘413 - Request Entity Too Large’ error response is returned.
- response_class: type[Response] | None¶
A custom subclass of
Responseto be used as the default response for all route handlers under the controller.
- response_cookies: ResponseCookies | None¶
A list of
Cookieinstances.
- response_headers: ResponseHeaders | None¶
A string keyed dictionary mapping
ResponseHeaderinstances.
- return_dto: type[AbstractDTO] | None | EmptyType¶
AbstractDTOto use for serializing outbound response data.
- security: Sequence[SecurityRequirement] | None¶
A sequence of dictionaries that to the schema of all route handlers under the controller.
- signature_namespace: dict[str, Any]¶
A mapping of names to types for use in forward reference resolution during signature modelling.
- signature_types: Sequence[Any]¶
A sequence of types for use in forward reference resolution during signature modelling.
These types will be added to the signature namespace using their
__name__attribute.
- type_decoders: TypeDecodersSequence | None¶
A sequence of tuples, each composed of a predicate testing for type identity and a msgspec hook for deserialization.
- type_encoders: TypeEncodersMap | None¶
A mapping of types to callables that transform them into types supported for serialization.
- websocket_class: type[WebSocket] | None¶
A custom subclass of
WebSocketto be used as the default websocket for all route handlers under the controller.
- class SponsorRenderController[source]¶
Bases:
ControllerController for rendering sponsor pages as HTML.
- path: str¶
A path fragment for the controller.
All route handlers under the controller will have the fragment appended to them. If not set it defaults to
/.
- include_in_schema: bool | EmptyType¶
A boolean flag dictating whether the route handler should be documented in the OpenAPI schema
- after_request: AfterRequestHookHandler | None¶
A sync or async function executed before a
Requestis passed to any route handler.If this function returns a value, the request will not reach the route handler, and instead this value will be used.
- after_response: AfterResponseHookHandler | None¶
A sync or async function called after the response has been awaited.
It receives the
Requestinstance and should not return any values.
- before_request: BeforeRequestHookHandler | None¶
A sync or async function called immediately before calling the route handler.
It receives the
Requestinstance and any non-Nonereturn value is used for the response, bypassing the route handler.
- cache_control: CacheControlHeader | None¶
A
CacheControlHeaderheader to add to route handlers of this controller.Can be overridden by route handlers.
- dependencies: Dependencies | None¶
A string keyed dictionary of dependency
Providerinstances.
- dto: type[AbstractDTO] | None | EmptyType¶
AbstractDTOto use for (de)serializing and validation of request data.
- etag: ETag | None¶
An
etagheader of typeETagto add to route handlers of this controller.Can be overridden by route handlers.
- exception_handlers: ExceptionHandlersMap | None¶
A map of handler functions to status codes and/or exception types.
- guards: Sequence[Guard] | None¶
A sequence of
Guardcallables.
- middleware: Sequence[Middleware] | None¶
A sequence of
Middleware.
- opt: Mapping[str, Any] | None¶
A string key mapping of arbitrary values that can be accessed in
Guardsor wherever you have access toRequestorASGI Scope.
- owner: Router¶
The
RouterorLitestarapp that owns the controller.This value is set internally by Litestar and it should not be set when subclassing the controller.
- parameters: ParametersMap | None¶
A mapping of
Parameterdefinitions available to all application paths.
- request_class: type[Request] | None¶
A custom subclass of
Requestto be used as the default request for all route handlers under the controller.
- request_max_body_size: int | None | EmptyType¶
Maximum allowed size of the request body in bytes. If this size is exceeded, a ‘413 - Request Entity Too Large’ error response is returned.
- response_class: type[Response] | None¶
A custom subclass of
Responseto be used as the default response for all route handlers under the controller.
- response_cookies: ResponseCookies | None¶
A list of
Cookieinstances.
- response_headers: ResponseHeaders | None¶
A string keyed dictionary mapping
ResponseHeaderinstances.
- return_dto: type[AbstractDTO] | None | EmptyType¶
AbstractDTOto use for serializing outbound response data.
- security: Sequence[SecurityRequirement] | None¶
A sequence of dictionaries that to the schema of all route handlers under the controller.
- signature_namespace: dict[str, Any]¶
A mapping of names to types for use in forward reference resolution during signature modelling.
- signature_types: Sequence[Any]¶
A sequence of types for use in forward reference resolution during signature modelling.
These types will be added to the signature namespace using their
__name__attribute.
- tags: Sequence[str] | None¶
A sequence of string tags that will be appended to the schema of all route handlers under the controller.
- type_decoders: TypeDecodersSequence | None¶
A sequence of tuples, each composed of a predicate testing for type identity and a msgspec hook for deserialization.
- type_encoders: TypeEncodersMap | None¶
A mapping of types to callables that transform them into types supported for serialization.
- websocket_class: type[WebSocket] | None¶
A custom subclass of
WebSocketto be used as the default websocket for all route handlers under the controller.
repositories¶
Sponsors domain repositories for database access.
- class SponsorshipLevelRepository[source]¶
Bases:
SQLAlchemyAsyncRepository[SponsorshipLevel]Repository for SponsorshipLevel database operations.
- model_type¶
alias of
SponsorshipLevel
- async get_by_slug(slug)[source]¶
Get a sponsorship level by its slug.
- Parameters:
slug (
str) – The slug to search for.- Return type:
- Returns:
The sponsorship level if found, None otherwise.
- class SponsorRepository[source]¶
Bases:
SQLAlchemyAsyncRepository[Sponsor]Repository for Sponsor database operations.
- class SponsorshipRepository[source]¶
Bases:
SQLAlchemyAsyncRepository[Sponsorship]Repository for Sponsorship database operations.
- model_type¶
alias of
Sponsorship
- async list_by_sponsor_id(sponsor_id, limit=100, offset=0)[source]¶
List sponsorships for a specific sponsor.
- Parameters:
- Return type:
- Returns:
List of sponsorships for the sponsor.
- async list_by_level_id(level_id, limit=100, offset=0)[source]¶
List sponsorships for a specific level.
- Parameters:
- Return type:
- Returns:
List of sponsorships for the level.
- async list_by_status(status, limit=100, offset=0)[source]¶
List sponsorships by status.
- Parameters:
status (
SponsorshipStatus) – The status to filter by.limit (
int) – Maximum number of sponsorships to return.offset (
int) – Number of sponsorships to skip.
- Return type:
- Returns:
List of sponsorships with the given status.
- async list_active(limit=100, offset=0)[source]¶
List active sponsorships.
- Parameters:
- Return type:
- Returns:
List of active sponsorships.
- async get_previous_for_sponsor(sponsor_id, current_year)[source]¶
Get the previous sponsorship for a sponsor.
- Parameters:
- Return type:
- Returns:
The previous sponsorship if found, None otherwise.
- class LegalClauseRepository[source]¶
Bases:
SQLAlchemyAsyncRepository[LegalClause]Repository for LegalClause database operations.
- model_type¶
alias of
LegalClause
- class ContractRepository[source]¶
Bases:
SQLAlchemyAsyncRepository[Contract]Repository for Contract database operations.
- async list_by_status(status, limit=100, offset=0)[source]¶
List contracts by status.
- Parameters:
status (
ContractStatus) – The status to filter by.limit (
int) – Maximum number of contracts to return.offset (
int) – Number of contracts to skip.
- Return type:
- Returns:
List of contracts with the given status.