-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
49 lines (39 loc) · 1003 Bytes
/
models.py
File metadata and controls
49 lines (39 loc) · 1003 Bytes
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
46
47
48
49
# models.py
import uuid
from pydantic import BaseModel, ConfigDict
from typing import List, Optional
class Flashcard(BaseModel):
question: str
answer: str
class FlashcardSetCreate(BaseModel):
title: str
subject: str
flashcards: List[Flashcard]
class FlashcardSet(BaseModel):
id: str
title: str
subject: str
flashcards: List[Flashcard]
owner_id: str
class UserBase(BaseModel):
username: str
is_admin: bool = False
class UserCreate(UserBase):
password: str
class User(UserBase):
id: str
is_admin: bool
model_config = ConfigDict(from_attributes=True)
class UserUpdate(BaseModel):
username: Optional[str] = None
is_admin: Optional[bool] = None
class Token(BaseModel):
access_token: str
token_type: str
is_admin: bool
username: str
class TokenData(BaseModel):
username: Optional[str] = None
class UserLogin(BaseModel):
username: str
password: str