repositories
Handles all database-specific logic using SQLAlchemy.
RecipeRepository
RecipeRepository(session: Session)
Concrete implementation of RecipeRepositoryPort using SQLAlchemy.
add_image
add_image(
recipe_id: UUID,
user_id: UUID,
caption: str | None = None,
display_order: int | None = 0,
) -> ImageEntity
Create and persist an Image linked to a recipe visible to user_id.
add_recipe
add_recipe(data: RecipeCreate, owner_id: UUID) -> RecipeEntity
Persist a recipe from creation data and return a domain entity.
add_recipes
add_recipes(data: list[RecipeCreate], owner_id: UUID) -> list[RecipeEntity]
Persist multiple recipes in a single atomic transaction.
delete_image
Delete an Image record by ID, only if its recipe is visible to user_id.
delete_recipe
Delete a recipe and all related entities, scoped to user.
get_recipe_by_id
Retrieve a recipe with all relationships loaded, visible to user.
image_belongs_to_user
Check if an image belongs to a recipe visible to the given user.
search_recipes
search_recipes(
user_id: UUID,
recipe_id: UUID | None = None,
title: str | None = None,
category: str | None = None,
is_veggie: bool | None = None,
season: str | None = None,
limit: int | None = None,
offset: int = 0,
ownership: str | None = None,
) -> PaginatedResult
Search recipes with dynamic filtering and pagination, visible to user.
RecipeShareRepository
RecipeShareRepository(session: Session)
UserRepository
UserRepository(session: Session)
Concrete implementation of UserRepositoryPort using SQLAlchemy.