SnapFeast / users /schemas.py
Testys's picture
Making migrations to code after removing huggingface secrets
2333542
raw
history blame
1.35 kB
from pydantic import BaseModel, EmailStr, Field
from typing import Optional, List
from datetime import datetime
class UserBase(BaseModel):
username: str = Field(..., min_length=3, max_length=50)
first_name: str = Field(..., min_length=1, max_length=50)
last_name: str = Field(..., min_length=1, max_length=50)
email: EmailStr
age: Optional[int] = Field(None, ge=0, le=120)
preferences: Optional[List[str]] = None
class UserCreate(UserBase):
password: str = Field(..., min_length=8)
class UserUpdate(BaseModel):
username: Optional[str] = Field(None, min_length=3, max_length=50)
first_name: Optional[str] = Field(None, min_length=1, max_length=50)
last_name: Optional[str] = Field(None, min_length=1, max_length=50)
email: Optional[EmailStr] = None
age: Optional[int] = Field(None, ge=0, le=120)
preferences: Optional[List[str]] = None
password: Optional[str] = Field(None, min_length=8)
class User(UserBase):
id: int
is_active: bool
is_admin: bool
created_at: datetime
updated_at: datetime
class Config:
orm_mode = True
class UserEmbeddingsBase(BaseModel):
embeddings: List[float]
class UserEmbeddingsCreate(UserEmbeddingsBase):
pass
class UserEmbeddings(UserEmbeddingsBase):
id: int
user_id: int
class Config:
orm_mode = True