Update users to use the new CRUD types
This commit is contained in:
parent
300cb7bd67
commit
bdf74c2dbd
3 changed files with 37 additions and 56 deletions
|
|
@ -1,26 +1,15 @@
|
|||
from src.infra.db import CRUD
|
||||
import abc
|
||||
from src.config.email import EmailAddress
|
||||
|
||||
from .data import User, UserDTO
|
||||
|
||||
|
||||
class UserRepo(abc.ABC):
|
||||
@abc.abstractmethod
|
||||
def create_user(self, user: UserDTO) -> User:
|
||||
pass
|
||||
|
||||
@abc.abstractmethod
|
||||
def get_user_by_id(self, user_id: int) -> User | None:
|
||||
pass
|
||||
|
||||
class UserRepo(CRUD[User, UserDTO]):
|
||||
@abc.abstractmethod
|
||||
def get_user_by_email(self, email: EmailAddress) -> User | None:
|
||||
pass
|
||||
|
||||
@abc.abstractmethod
|
||||
def update_user(self, user: User):
|
||||
pass
|
||||
|
||||
@abc.abstractmethod
|
||||
def auth_as_user(self, user: UserDTO) -> User | None:
|
||||
pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue