add singup endpoint
This commit is contained in:
@@ -1,11 +1,19 @@
|
||||
from src.schemas.users import UserCreate
|
||||
from src.schemas.users import UserWithHashedPass, UserRequest
|
||||
from src.services.base import BaseService
|
||||
from src.utils.auth_manager import AuthManger
|
||||
|
||||
|
||||
class AuthService(BaseService):
|
||||
|
||||
async def registration(self, cred: UserCreate):
|
||||
async def registration(self, cred: UserRequest):
|
||||
hashed_pass = AuthManger.get_password_hash(cred.password)
|
||||
print(cred.password)
|
||||
print(hashed_pass)
|
||||
user_to_insert = UserWithHashedPass(
|
||||
username=cred.username,
|
||||
email=cred.email,
|
||||
hashed_password=hashed_pass,
|
||||
is_active=True,
|
||||
is_superuser=False
|
||||
)
|
||||
result = await self.session.user.create_one(user_to_insert)
|
||||
await self.session.commit()
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user