2022-04-29 14:13:54 +02:00
|
|
|
from abc import ABC, abstractclassmethod, abstractproperty
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
|
|
|
|
|
|
class BaseUser(BaseModel):
|
|
|
|
email: str
|
|
|
|
name: str
|
|
|
|
username: str
|
|
|
|
|
|
|
|
class BaseGroup(BaseModel):
|
|
|
|
name: str
|
|
|
|
|
|
|
|
|
2022-04-29 14:56:51 +02:00
|
|
|
class Consumer(ABC):
|
2022-04-29 14:13:54 +02:00
|
|
|
|
|
|
|
@abstractproperty
|
|
|
|
def api(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
@abstractclassmethod
|
|
|
|
def create_user(user: BaseUser) -> BaseUser:
|
|
|
|
pass
|
|
|
|
|
|
|
|
@abstractclassmethod
|
|
|
|
def create_group(group: BaseGroup) -> BaseGroup:
|
|
|
|
pass
|