new api service and logic implemented
This commit is contained in:
182
ApiLayers/ApiValidations/Request/authentication.py
Normal file
182
ApiLayers/ApiValidations/Request/authentication.py
Normal file
@@ -0,0 +1,182 @@
|
||||
from ApiValidations.Request import BaseModelRegular
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class ChangePasswordValidation:
|
||||
tr = {"old_password": "Eski Şifre", "new_password": "Yeni Şifre"}
|
||||
en = {"old_password": "Old Password", "new_password": "New Password"}
|
||||
|
||||
|
||||
class ChangePassword(BaseModelRegular, ChangePasswordValidation):
|
||||
old_password: str = Field(..., example="current123")
|
||||
new_password: str = Field(..., example="newpass456")
|
||||
|
||||
model_config = ConfigDict(
|
||||
json_schema_extra={
|
||||
"example": {"old_password": "current123", "new_password": "newpass456"}
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
class CreatePasswordValidation:
|
||||
tr = {
|
||||
"password_token": "Şifre Token",
|
||||
"password": "Şifre",
|
||||
"re_password": "Şifre Tekrar",
|
||||
}
|
||||
en = {
|
||||
"password_token": "Password Token",
|
||||
"password": "Password",
|
||||
"re_password": "Re-Password",
|
||||
}
|
||||
|
||||
|
||||
class CreatePassword(BaseModelRegular, CreatePasswordValidation):
|
||||
password_token: str = Field(..., example="abc123token")
|
||||
password: str = Field(..., example="newpass123")
|
||||
re_password: str = Field(..., example="newpass123")
|
||||
|
||||
model_config = ConfigDict(
|
||||
json_schema_extra={
|
||||
"example": {
|
||||
"password_token": "abc123token",
|
||||
"password": "newpass123",
|
||||
"re_password": "newpass123",
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
class OccupantSelectionValidation:
|
||||
tr = {"occupant_uu_id": "Kiracı UU ID", "build_part_uu_id": "Bölüm UU ID"}
|
||||
en = {"occupant_uu_id": "Occupant UU ID", "build_part_uu_id": "Build Part UU ID"}
|
||||
|
||||
|
||||
class OccupantSelection(BaseModel, OccupantSelectionValidation):
|
||||
build_living_space_uu_id: str = Field(
|
||||
..., example="987fcdeb-51a2-43e7-9876-543210987654"
|
||||
)
|
||||
|
||||
model_config = ConfigDict(
|
||||
json_schema_extra={
|
||||
"example": [
|
||||
{"company_uu_id": "abcdef12-3456-7890-abcd-ef1234567890"},
|
||||
{"build_living_space_uu_id": "987fcdeb-51a2-43e7-9876-543210987654"},
|
||||
],
|
||||
}
|
||||
)
|
||||
|
||||
@property
|
||||
def is_employee(self):
|
||||
return False
|
||||
|
||||
@property
|
||||
def is_occupant(self):
|
||||
return True
|
||||
|
||||
|
||||
class EmployeeSelectionValidation:
|
||||
tr = {"company_uu_id": "Şirket UU ID"}
|
||||
en = {"company_uu_id": "Company UU ID"}
|
||||
|
||||
|
||||
class EmployeeSelection(BaseModel, EmployeeSelectionValidation):
|
||||
company_uu_id: str = Field(..., example="abcdef12-3456-7890-abcd-ef1234567890")
|
||||
|
||||
model_config = ConfigDict(
|
||||
json_schema_extra={
|
||||
"example": [
|
||||
{"company_uu_id": "abcdef12-3456-7890-abcd-ef1234567890"},
|
||||
{"build_living_space_uu_id": "987fcdeb-51a2-43e7-9876-543210987654"},
|
||||
],
|
||||
}
|
||||
)
|
||||
|
||||
@property
|
||||
def is_employee(self):
|
||||
return True
|
||||
|
||||
@property
|
||||
def is_occupant(self):
|
||||
return False
|
||||
|
||||
|
||||
class LoginValidation:
|
||||
tr = {
|
||||
"domain": "Domain",
|
||||
"access_key": "Erişim Anahtarı",
|
||||
"password": "Şifre",
|
||||
"remember_me": "Beni Hatırla",
|
||||
}
|
||||
en = {
|
||||
"domain": "Domain",
|
||||
"access_key": "Access Key",
|
||||
"password": "Password",
|
||||
"remember_me": "Remember Me",
|
||||
}
|
||||
|
||||
|
||||
class Login(BaseModelRegular, LoginValidation):
|
||||
domain: str = Field(..., example="example.com")
|
||||
access_key: str = Field(..., example="user@example.com")
|
||||
password: str = Field(..., example="password123")
|
||||
remember_me: Optional[bool] = Field(False, example=True)
|
||||
|
||||
model_config = ConfigDict(
|
||||
json_schema_extra={
|
||||
"example": {
|
||||
"domain": "evyos.com.tr",
|
||||
"access_key": "karatay.berkay.sup@evyos.com.tr",
|
||||
"password": "string",
|
||||
"remember_me": False,
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
class LogoutValidation:
|
||||
tr = {"domain": "Domain"}
|
||||
en = {"domain": "Domain"}
|
||||
|
||||
|
||||
class Logout(BaseModelRegular, LogoutValidation):
|
||||
domain: str = Field(..., example="example.com")
|
||||
|
||||
model_config = ConfigDict(json_schema_extra={"example": {"domain": "example.com"}})
|
||||
|
||||
|
||||
class RememberValidation:
|
||||
tr = {"domain": "Domain", "refresh_token": "Yenileme Anahtarı"}
|
||||
en = {"domain": "Domain", "refresh_token": "Refresh Token"}
|
||||
|
||||
|
||||
class Remember(BaseModelRegular, RememberValidation):
|
||||
domain: str = Field(..., example="example.com")
|
||||
refresh_token: str = Field(..., example="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...")
|
||||
|
||||
model_config = ConfigDict(
|
||||
json_schema_extra={
|
||||
"example": {
|
||||
"domain": "example.com",
|
||||
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
class ForgotValidation:
|
||||
tr = {"domain": "Domain", "access_key": "Erişim Anahtarı"}
|
||||
en = {"domain": "Domain", "access_key": "Access Key"}
|
||||
|
||||
|
||||
class Forgot(BaseModelRegular, ForgotValidation):
|
||||
domain: str = Field(..., example="example.com")
|
||||
access_key: str = Field(..., example="user@example.com")
|
||||
|
||||
model_config = ConfigDict(
|
||||
json_schema_extra={
|
||||
"example": {"domain": "example.com", "access_key": "user@example.com"}
|
||||
}
|
||||
)
|
||||
Reference in New Issue
Block a user