Skip to main content

Saga State Repository

Description

A repository for persisting and retrieving SagaStateModels.

Definition Schema

The definition for a saga_state_repository component expects the following structure:

{
"description": "Input DTO for defining a repository class.",
"properties": {
"name": {
"description": "The name of the repository class (e.g., UserRepository).",
"examples": [
"UserRepository",
"ProductRepository"
],
"title": "Name",
"type": "string"
},
"aggregate_name": {
"description": "The name of the aggregate this repository manages (e.g., User).",
"examples": [
"User",
"Product"
],
"title": "Aggregate Name",
"type": "string"
},
"aggregate_module": {
"description": "The Python module path for the aggregate (e.g., app_root_name.domain.users.aggregates).",
"examples": [
"app_root_name.domain.users.aggregates",
"app_root_name.domain.inventory.aggregates"
],
"title": "Aggregate Module",
"type": "string"
},
"aggregate_id_type_str": {
"default": "UUID",
"description": "The type of the aggregate's ID (e.g., UUID, int, str).",
"examples": [
"UUID",
"int"
],
"title": "Aggregate Id Type Str",
"type": "string"
},
"base_repository_module": {
"default": "castlecraft_engineer.abstractions.aggregate",
"description": "The module path for the base repository class.",
"title": "Base Repository Module",
"type": "string"
},
"base_repository_class_name": {
"default": "AggregateRepository",
"description": "The name of the base repository class to inherit from.",
"title": "Base Repository Class Name",
"type": "string"
},
"db_model_module": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The Python module path for the database model (e.g., app_root_name.infrastructure.persistence.models.user_model). If None, assumes same name as aggregate in a 'models' submodule.",
"title": "Db Model Module"
},
"db_model_name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The name of the database model class (e.g., UserOrm). If None, assumes aggregate_name + 'Orm'.",
"title": "Db Model Name"
}
},
"required": [
"name",
"aggregate_name",
"aggregate_module"
],
"title": "RepositoryInputDTO",
"type": "object"
}

Naming and Location Conventions

Class: PascalCase, typically ends with 'SagaStateRepository'. File: ${saga_state_repository_name}.py (based on ${saga_state_repository_name}). Location: app/infrastructure/persistence/${bounded_ctx}/repositories. (Requires context: ['bounded_ctx'])

Example Definition

No example available.