Dependencies
dependencies
¶
FastAPI request-scoped dependencies that bridge transport concerns (headers) to the domain layer
ensure_profile_exists(profile_id=Depends(get_profile_id_from_header))
async
¶
Dependency that requires X-Profile-ID and ensures the profile exists
Implicitly creates the profile when it doesn't exist yet
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
profile_id
|
str
|
Profile id from the header |
Depends(get_profile_id_from_header)
|
Returns:
| Type | Description |
|---|---|
str
|
The validated profile id |
Raises:
| Type | Description |
|---|---|
HTTPException
|
If the |
DatabaseError
|
If the profile can't be read or created |
get_job_manager(request)
¶
Endpoint dependency returning the lifespan-scoped JobQueueManager
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
Request
|
The |
required |
Returns:
| Type | Description |
|---|---|
JobQueueManager
|
The single |
get_processor(request)
¶
get_profile_id_from_header(x_profile_id=Header(None))
async
¶
get_profile_id_optional(profile_id=Depends(get_profile_id_from_header))
async
¶
Dependency that returns the profile id when present, ensuring it exists
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
profile_id
|
str
|
Profile id from the header |
Depends(get_profile_id_from_header)
|
Returns:
| Type | Description |
|---|---|
str | None
|
The validated profile id, or |
Raises:
| Type | Description |
|---|---|
DatabaseError
|
If the profile can't be read or created |