[rewrite] Work on user registration, slightly polished schemas structure
This commit is contained in:
1 parent
5d12391635
commit
9e56eeca3f
12 files changed
+381
-39
No files matched your search
@@ -1,13 +0,0 @@
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, EmailStr, Field
|
||||
|
||||
|
||||
class UserRegisterSchema(BaseModel):
|
||||
username: str = Field(..., min_length=3, max_length=64)
|
||||
email: EmailStr = Field(...)
|
||||
phone_number: str = Field(..., min_length=10, max_length=15, pattern=r'^\+[0-9]{1,3} [0-9]{1,9}$')
|
||||
password: str = Field(..., min_length=6, max_length=128)
|
||||
shop_id: Optional[int] = None
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
@@ -0,0 +1,17 @@
|
||||
from pydantic import BaseModel, EmailStr, Field
|
||||
|
||||
|
||||
class UserRegisterSchema(BaseModel):
|
||||
username: str = Field(..., min_length=3, max_length=64)
|
||||
email: EmailStr = Field(...)
|
||||
phone_number: str = Field(..., min_length=2, max_length=16, pattern=r'^\+[1-9]\d{1,14}$')
|
||||
password: str = Field(..., min_length=6, max_length=128)
|
||||
shop_id: int = 0
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
|
||||
class UserLoginSchema(BaseModel):
|
||||
shop_id: int = 0
|
||||
username: str = Field(..., min_length=3, max_length=64)
|
||||
password: str = Field(..., min_length=6, max_length=128)
|
||||
Reference in new issue
Block a user