-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschemas.py
65 lines (41 loc) · 1.07 KB
/
schemas.py
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from typing import Optional
from pydantic import BaseModel, ConfigDict
from datetime import datetime
# User
class UserBase(BaseModel):
first_name: str
last_name: str
class UserCreate(UserBase):
pass
class UserUpdate(UserBase):
first_name: Optional[str] = None
last_name: Optional[str] = None
idea_id: Optional[int] = None
class User(UserBase):
model_config = ConfigDict(from_attributes=True)
id: int
created_at: datetime
# Direction
class DirectionBase(BaseModel):
name: str
class DirectionCreate(DirectionBase):
pass
class DirectionUpdate(DirectionBase):
name: Optional[str] = None
class Direction(DirectionBase):
model_config = ConfigDict(from_attributes=True)
id: int
created_at: datetime
# Idea
class IdeaBase(BaseModel):
name: str
direction_id: int
class IdeaCreate(IdeaBase):
pass
class IdeaUpdate(IdeaBase):
name: Optional[str] = None
direction_id: Optional[int] = None
class Idea(IdeaBase):
model_config = ConfigDict(from_attributes=True)
id: int
created_at: datetime