flask-demo-api/flask_demo_api/protocols/repository.py

23 lines
566 B
Python
Raw Normal View History

2024-04-15 02:16:07 +03:00
from abc import abstractmethod
from typing import Protocol
2024-04-16 01:03:02 +03:00
from flask_demo_api.protocols.models import KeyDTO
2024-04-15 02:16:07 +03:00
class Repository(Protocol):
@abstractmethod
def get_key(self, obj: KeyDTO) -> KeyDTO | None:
raise NotImplementedError
@abstractmethod
2024-04-16 04:48:10 +03:00
def add_key(self, obj: KeyDTO) -> KeyDTO | None:
2024-04-15 02:16:07 +03:00
raise NotImplementedError
@abstractmethod
2024-04-16 04:48:10 +03:00
def put_key(self, obj: KeyDTO) -> KeyDTO | None:
2024-04-15 02:16:07 +03:00
raise NotImplementedError
2024-04-16 01:03:02 +03:00
@abstractmethod
def delete_key(self, obj: KeyDTO) -> None:
raise NotImplementedError