ports_primary
Define how services can be used by external consumers (e.g., HTTP API, CLI).
AuthServicePort
RecipeExportServicePort
RecipeImportServicePort
Primary port for importing recipes from external sources.
parse_instagram
abstractmethod
parse_instagram(data: InstagramResponse) -> list[ParsedRecipe]
Parse Instagram data and return parsed recipes with image URLs.
RecipeServicePort
add_recipe_image
abstractmethod
Add an image to a recipe owned by user_id and return its image ID.
create_recipe
abstractmethod
create_recipe(data: RecipeCreate, owner_id: UUID) -> RecipeEntity
Persist a new recipe with all related entities and return the created Recipe.
create_recipes
abstractmethod
create_recipes(data: list[RecipeCreate], owner_id: UUID) -> list[RecipeEntity]
Persist multiple recipes atomically and return all created Recipe entities.
delete_recipe
abstractmethod
Delete a recipe by ID. Returns True if deleted, False if not found/owned.
delete_recipe_image
abstractmethod
Delete an image from storage and database. Returns True if deleted, False if not found/owned.
get_recipe_by_id
abstractmethod
Retrieve a recipe by its ID, scoped to the given user.
get_recipe_image
abstractmethod
Retrieve image bytes for a given image ID, scoped to the given user.
search_recipes
abstractmethod
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 for recipes using dynamic filters, visible to the given user.
update_recipe
abstractmethod
update_recipe(
recipe_id: UUID, data: RecipeUpdate, user_id: UUID
) -> RecipeEntity | None
Full replacement of a recipe (PUT semantics). Returns None if not found/owned.
RecipeShareServicePort
Primary port for recipe sharing operations.
accept_all_shares
abstractmethod
accept_all_shares(user_id: UUID) -> list[RecipeShareEntity]
Accept all pending share invitations for the current user.
accept_share
abstractmethod
accept_share(share_id: UUID, user_id: UUID) -> RecipeShareEntity
Accept a share invitation.
get_pending_shares
abstractmethod
get_pending_shares(user_id: UUID) -> list[RecipeShareEntity]
List pending share invitations for the current user.
get_pending_shares_count
abstractmethod
Count pending share invitations for the current user.
get_recipe_shares
abstractmethod
get_recipe_shares(recipe_id: UUID, user_id: UUID) -> list[RecipeShareEntity]
List all collaborators for a recipe. Only the owner can view this.
leave_recipe
abstractmethod
Remove yourself from a shared recipe.
reject_share
abstractmethod
reject_share(share_id: UUID, user_id: UUID) -> RecipeShareEntity
Reject a share invitation.
remove_share
abstractmethod
Remove a share (owner revokes or shared user leaves).
share_recipe
abstractmethod
share_recipe(
recipe_id: UUID, email: str, role: ShareRole, user_id: UUID
) -> RecipeShareEntity
Share a recipe with another user by email. Only the owner can share.