2025-03-08 17:27:53 +01:00

52 lines
1.8 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from uuid import UUID
from pydantic import BaseModel, ConfigDict, EmailStr, Field, SecretStr
config = ConfigDict(from_attributes=True)
# TODO: add pydantic field validator for strong password
class UserSchema(BaseModel):
model_config = config
email: EmailStr = Field(
title="Users email", description="Users email", examples=["john@domain.com"]
)
first_name: str = Field(
title="Users first name", description="Users first name", examples=["John"]
)
last_name: str = Field(
title="Users last name", description="Users last name", examples=["Doe"]
)
password: SecretStr = Field(
title="Users password",
description="Users password",
examples=["@SuperSecret123"],
)
class UserResponse(BaseModel):
id: UUID = Field(title="Users id", description="Users id")
email: EmailStr = Field(title="Users email", description="Users email")
first_name: str = Field(title="Users first name", description="Users first name")
last_name: str = Field(title="Users last name", description="Users last name")
access_token: str = Field(title="Users token", description="Users token")
class TokenResponse(BaseModel):
access_token: str = Field(
title="Users access token", description="Users access token"
)
token_type: str = Field(title="Users token type", description="Users token type")
class UserLogin(BaseModel):
model_config = config
email: EmailStr = Field(
title="Users email", description="Users email", examples=["john@domain.com"]
)
password: SecretStr = Field(
title="Users password",
description="Users password",
examples=["@SuperSecret123"],
)