from abc import ABC, abstractmethod class PostRepository(ABC): @abstractmethod def list(self, page=1, per_page=10, order_by="-created"): pass @abstractmethod def add(self, post): pass @abstractmethod def get(self, post_id): pass @abstractmethod def update(self, post): """Update an existing post.""" pass @abstractmethod def delete(self, post_id): """Delete a post by its ID.""" pass @abstractmethod def search(self, query: str): pass @abstractmethod def rate_post(self, post_id, user_id, rating: int): pass