init
Browse files
cbh/api/account/models.py
CHANGED
|
@@ -24,7 +24,7 @@ class AccountModel(MongoBaseModel):
|
|
| 24 |
status: AccountStatus = AccountStatus.ACTIVE
|
| 25 |
accountType: AccountType = Field(default=AccountType.USER)
|
| 26 |
|
| 27 |
-
opportunity: CoachOpportunity
|
| 28 |
|
| 29 |
datetimeInserted: datetime = Field(default_factory=datetime.now)
|
| 30 |
datetimeUpdated: datetime = Field(default_factory=datetime.now)
|
|
|
|
| 24 |
status: AccountStatus = AccountStatus.ACTIVE
|
| 25 |
accountType: AccountType = Field(default=AccountType.USER)
|
| 26 |
|
| 27 |
+
opportunity: CoachOpportunity | None = None
|
| 28 |
|
| 29 |
datetimeInserted: datetime = Field(default_factory=datetime.now)
|
| 30 |
datetimeUpdated: datetime = Field(default_factory=datetime.now)
|
cbh/api/security/db_requests.py
CHANGED
|
@@ -43,6 +43,7 @@ async def save_account(data: RegisterAccountRequest) -> AccountModel:
|
|
| 43 |
email=data.email,
|
| 44 |
password=data.password,
|
| 45 |
datetimeUpdated=datetime.now(),
|
|
|
|
| 46 |
)
|
| 47 |
await settings.DB_CLIENT.accounts.insert_one(account.to_mongo())
|
| 48 |
return account
|
|
|
|
| 43 |
email=data.email,
|
| 44 |
password=data.password,
|
| 45 |
datetimeUpdated=datetime.now(),
|
| 46 |
+
accountType=data.accountType,
|
| 47 |
)
|
| 48 |
await settings.DB_CLIENT.accounts.insert_one(account.to_mongo())
|
| 49 |
return account
|
cbh/api/security/schemas.py
CHANGED
|
@@ -4,6 +4,7 @@ Schema definitions for security API endpoints.
|
|
| 4 |
|
| 5 |
from pydantic import BaseModel, EmailStr
|
| 6 |
|
|
|
|
| 7 |
from cbh.api.account.models import AccountModel
|
| 8 |
from cbh.api.security.dto import AccessToken
|
| 9 |
|
|
@@ -17,6 +18,7 @@ class RegisterAccountRequest(BaseModel):
|
|
| 17 |
lastName: str
|
| 18 |
email: str
|
| 19 |
password: str
|
|
|
|
| 20 |
|
| 21 |
|
| 22 |
class LoginAccountRequest(BaseModel):
|
|
|
|
| 4 |
|
| 5 |
from pydantic import BaseModel, EmailStr
|
| 6 |
|
| 7 |
+
from cbh.api.account.dto import AccountType
|
| 8 |
from cbh.api.account.models import AccountModel
|
| 9 |
from cbh.api.security.dto import AccessToken
|
| 10 |
|
|
|
|
| 18 |
lastName: str
|
| 19 |
email: str
|
| 20 |
password: str
|
| 21 |
+
accountType: AccountType
|
| 22 |
|
| 23 |
|
| 24 |
class LoginAccountRequest(BaseModel):
|