52ff2f80ad
CI/CD Pipeline / Validate Code Quality And Tests (push) Has been cancelled
CI/CD Pipeline / Frontend Lint (push) Has been cancelled
Deploy / Deploy Staging (push) Has been cancelled
Deploy / Build Production Runtime Images (push) Has been cancelled
Deploy / Deploy Production (push) Has been cancelled
Deploy / Production Browser E2E (push) Has been cancelled
36 lines
911 B
Python
36 lines
911 B
Python
"""Recipe repository port."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import List, Optional, Protocol
|
|
|
|
from packages.domain.recipe import Recipe, RecipeItem
|
|
|
|
|
|
class RecipeRepository(Protocol):
|
|
"""配方仓储接口"""
|
|
|
|
def list_by_user(
|
|
self,
|
|
user_id: str,
|
|
*,
|
|
skip: int = 0,
|
|
limit: int = 50,
|
|
) -> List[Recipe]: ...
|
|
|
|
def get(self, recipe_id: str, user_id: str) -> Optional[Recipe]: ...
|
|
|
|
def create(self, recipe: Recipe) -> Recipe: ...
|
|
|
|
def update(self, recipe: Recipe) -> Recipe: ...
|
|
|
|
def delete(self, recipe_id: str, user_id: str) -> bool: ...
|
|
|
|
def count_by_user(self, user_id: str, is_active: bool = True) -> int: ...
|
|
|
|
def list_items(self, recipe_id: str) -> List[RecipeItem]: ...
|
|
|
|
def create_items(self, items: List[RecipeItem]) -> List[RecipeItem]: ...
|
|
|
|
def delete_items_by_recipe(self, recipe_id: str) -> int: ...
|