-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschemas.py
More file actions
52 lines (36 loc) · 943 Bytes
/
schemas.py
File metadata and controls
52 lines (36 loc) · 943 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
50
51
52
# schemas.py
from pydantic import BaseModel
import datetime
from models import TransactionInfo
from typing import Optional, List
class Token(BaseModel):
access_token: str
token_type: str
class TokenData(BaseModel):
username: str | None = None
class User(BaseModel):
username: str
email: str | None = None
password: str | None = None
full_name: str | None = None
disabled: bool | None = None
class Config:
orm_mode = True
class UserInDB(User):
hashed_password: str
# TO support creation and update APIs
class CreateAndUpdateTransaction(BaseModel):
name: str
description: str
amount: float
currency: str
# TO support list and get APIs
class Transaction(CreateAndUpdateTransaction):
id: int
class Config:
orm_mode = True
# To support list cars API
class PaginatedTransactionInfo(BaseModel):
limit: int
offset: int
data: List[Transaction]