File size: 1,221 Bytes
60cc4ec
fc76af0
60cc4ec
fc76af0
 
60cc4ec
 
fc76af0
60cc4ec
64d8204
fc76af0
 
60cc4ec
 
 
 
 
 
 
 
 
fc76af0
 
 
60cc4ec
 
 
 
fc76af0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2333542
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from pydantic import BaseModel, EmailStr, Field
from typing import Optional, List
from datetime import datetime

class UserBase(BaseModel):
    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):
    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