Geen omschrijving

post_repository.py 613B

123456789101112131415161718192021222324252627282930
  1. from abc import ABC, abstractmethod
  2. class PostRepository(ABC):
  3. @abstractmethod
  4. def list(self, page=1, per_page=10, order_by="-created"): pass
  5. @abstractmethod
  6. def add(self, post): pass
  7. @abstractmethod
  8. def get(self, post_id): pass
  9. @abstractmethod
  10. def update(self, post):
  11. """Update an existing post."""
  12. pass
  13. @abstractmethod
  14. def delete(self, post_id):
  15. """Delete a post by its ID."""
  16. pass
  17. @abstractmethod
  18. def search(self, query: str): pass
  19. @abstractmethod
  20. def rate_post(self, post_id, user_id, rating: int): pass