service
A generic service object implementation.
Service object is generic on the domain model type, which should be a SQLAlchemy model.
Service ¶
Bases: Generic[ModelT]
Generic Service object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**repo_kwargs |
Any
|
passed as keyword args to repo instantiation. |
{}
|
create
async
¶
Wrap repository instance creation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data |
ModelT
|
Representation to be created. |
required |
Returns:
| Type | Description |
|---|---|
ModelT
|
Representation of created instance. |
delete
async
¶
Wrap repository delete operation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id_ |
Any
|
Identifier of instance to be deleted. |
required |
Returns:
| Type | Description |
|---|---|
ModelT
|
Representation of the deleted instance. |
enqueue_background_task
async
¶
get
async
¶
Wrap repository scalar operation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id_ |
Any
|
Identifier of instance to be retrieved. |
required |
Returns:
| Type | Description |
|---|---|
ModelT
|
Representation of instance with identifier |
list
async
¶
Wrap repository scalars operation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*filters |
FilterTypes
|
Collection route filters. |
()
|
**kwargs |
Any
|
Keyword arguments for attribute based filtering. |
{}
|
Returns:
| Type | Description |
|---|---|
list[ModelT]
|
The list of instances retrieved from the repository. |
UnauthorizedException ¶
Bases: ServiceException
A user tried to do something they shouldn't have.
make_service_callback
async
¶
make_service_callback(
_ctx, *, service_module_name, service_type_fqdn, service_method_name, **kwargs
)
Make an async service callback.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
_ctx |
Context
|
the SAQ context |
required |
service_module_name |
str
|
Module of service type to instantiate. |
required |
service_type_fqdn |
str
|
Reference to service type in module. |
required |
service_method_name |
str
|
Method to be called on the service object. |
required |
**kwargs |
Any
|
Unpacked into the service method call as keyword arguments. |
{}
|