EmailDone1
Some checks failed
K8S Fission Deployment / Deployment fission functions (push) Failing after 22s
Some checks failed
K8S Fission Deployment / Deployment fission functions (push) Failing after 22s
This commit is contained in:
@@ -1,33 +1,37 @@
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel, Field, EmailStr, root_validator
|
||||
from typing import Optional
|
||||
from enum import IntEnum
|
||||
|
||||
# Validate dau vao email
|
||||
|
||||
class UserEmailRequest(BaseModel):
|
||||
email: EmailStr = Field(..., description="Email address")
|
||||
provider: Optional[str] = Field(None, description="Email service provider")
|
||||
is_primary: Optional[bool] = Field(None, description= "is primary email ")
|
||||
|
||||
@root_validator(pre=True)
|
||||
def auto_detect_provider(cls, values):
|
||||
email = values.get("email")
|
||||
provider = values.get("provider")
|
||||
|
||||
if not provider and email:
|
||||
domain_part = email.split('@')[-1]
|
||||
values["provider"] = domain_part.split('.')[0]
|
||||
|
||||
return values
|
||||
|
||||
|
||||
class TagKind(IntEnum):
|
||||
ProjectGroup = 1
|
||||
ProjectData = 2
|
||||
ProjectMember = 3
|
||||
ProjectDiscussionTopic = 4
|
||||
Project = 5
|
||||
Ticket = 6
|
||||
class UserEmailUpdateRequest(BaseModel):
|
||||
email: Optional[EmailStr] = Field(None, description="Email address")
|
||||
provider: Optional[str] = Field(None, description="Email service provider")
|
||||
is_primary: Optional[bool] = Field(None, description= "is primary email ")
|
||||
|
||||
@root_validator(pre=True)
|
||||
def auto_detect_provider(cls, values):
|
||||
email = values.get("email")
|
||||
provider = values.get("provider")
|
||||
|
||||
class TagRequest(BaseModel):
|
||||
tag: str = Field(..., max_length=128)
|
||||
kind: TagKind
|
||||
ref: Optional[str] = Field(default=None, max_length=36)
|
||||
primary_color: Optional[str] = Field(default=None, max_length=8)
|
||||
secondary_color: Optional[str] = Field(default=None, max_length=8)
|
||||
if not provider and email:
|
||||
domain_part = email.split('@')[-1]
|
||||
values["provider"] = domain_part.split('.')[0]
|
||||
|
||||
|
||||
class TagRequestUpdate(BaseModel):
|
||||
tag: str = Field(..., max_length=128)
|
||||
kind: TagKind
|
||||
ref: Optional[str] = Field(default=None, max_length=36)
|
||||
primary_color: Optional[str] = Field(default=None, max_length=8)
|
||||
secondary_color: Optional[str] = Field(default=None, max_length=8)
|
||||
|
||||
|
||||
class TagRefRequest(BaseModel):
|
||||
ref: str = Field(..., max_length=64)
|
||||
sub_ref: Optional[str] = Field(default=None, max_length=1024)
|
||||
return values
|
||||
Reference in New Issue
Block a user