finish for init core
This commit is contained in:
1
fuware/services/__init__.py
Normal file
1
fuware/services/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
from .user import *
|
6
fuware/services/_base_service/__init__.py
Normal file
6
fuware/services/_base_service/__init__.py
Normal file
@ -0,0 +1,6 @@
|
||||
from fuware.core.config import get_app_settings
|
||||
|
||||
|
||||
class BaseService:
|
||||
def __init__(self) -> None:
|
||||
self.setting = get_app_settings()
|
1
fuware/services/user/__init__.py
Normal file
1
fuware/services/user/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
from .user_service import *
|
19
fuware/services/user/user_service.py
Normal file
19
fuware/services/user/user_service.py
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
from sqlalchemy.orm import Session
|
||||
from fuware.repos import RepositoryUsers
|
||||
from fuware.services._base_service import BaseService
|
||||
from fuware.schemas import UserCreate
|
||||
|
||||
|
||||
class UserService(BaseService):
|
||||
def __init__(self):
|
||||
self.repos = RepositoryUsers()
|
||||
|
||||
def get_all(self, skip: int = 0, limit: int = 100):
|
||||
return self.repos.get_all(skip=skip, limit=limit)
|
||||
|
||||
def get_by_username(self, username: str):
|
||||
return self.repos.get_by_username(username)
|
||||
|
||||
def create(self, db: Session, user: UserCreate):
|
||||
return self.repos.create(db=db, user=user)
|
Reference in New Issue
Block a user