MCPcopy Create free account
hub / github.com/PacktPublishing/Full-Stack-FastAPI-React-and-MongoDB / UserBase

Class UserBase

chapter7/backend/models.py:39–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37
38
39class UserBase(MongoBaseModel):
40
41 username: str = Field(..., min_length=3, max_length=15)
42 email: str = Field(...)
43 password: str = Field(...)
44 role: Role
45
46 @validator("email")
47 def valid_email(cls, v):
48
49 try:
50 email = validate_email(v).email
51 return email
52 except EmailNotValidError as e:
53
54 raise EmailNotValidError
55
56
57class LoginBase(BaseModel):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected