This commit is contained in:
2024-04-14 23:16:07 +00:00
parent 24d1a80164
commit 3335ee5e22
14 changed files with 122 additions and 1 deletions

View File

View File

@@ -0,0 +1,7 @@
from dataclasses import dataclass
@dataclass()
class KeyDTO:
key: str
val: str

View File

@@ -0,0 +1,18 @@
from abc import abstractmethod
from typing import Protocol
from flask_demo_api.protocols.models import KeyDTO
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