add singup endpoint

This commit is contained in:
IluaAir
2025-07-07 12:01:02 +03:00
parent 31879ddf30
commit 61512f70d4
11 changed files with 64 additions and 67 deletions

View File

@@ -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