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

23 lines
552 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
def add_key(self, obj: KeyDTO) -> KeyDTO:
raise NotImplementedError
@abstractmethod
def put_key(self, obj: KeyDTO) -> KeyDTO:
raise NotImplementedError
2024-04-16 01:03:02 +03:00
@abstractmethod
def delete_key(self, obj: KeyDTO) -> None:
raise NotImplementedError