-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.py
99 lines (63 loc) · 1.63 KB
/
models.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# models.py
from pydantic import BaseModel, EmailStr
from typing import Optional, List
from datetime import datetime
class UserBase(BaseModel):
email: EmailStr
class UserCreate(UserBase):
password: str
class UserUpdate(BaseModel):
email: Optional[EmailStr] = None
password: Optional[str] = None
class User(UserBase):
id: int
created_at: datetime
class Config:
from_attributes = True
class OAuth2Client(BaseModel):
client_id: str
client_secret: Optional[str]
redirect_uris: List[str]
created_at: Optional[datetime]
class Config:
from_attributes = True
class OAuth2ClientCreate(BaseModel):
client_id: str
client_secret: str
redirect_uris: List[str]
class OAuth2ClientUpdate(BaseModel):
client_secret: Optional[str] = None
redirect_uris: Optional[List[str]] = None
class OAuth2AuthorizationCode(BaseModel):
code: str
client_id: str
redirect_uri: str
scope: Optional[str]
user_id: int
code_challenge: str
code_challenge_method: str
expires_at: datetime
class TokenRequest(BaseModel):
grant_type: str
code: Optional[str]
redirect_uri: Optional[str]
client_id: Optional[str]
code_verifier: Optional[str]
class UserInDB(BaseModel):
id: int
email: str
hashed_password: str
class Config:
from_attributes = True
class RoleBase(BaseModel):
role_name: str
class RoleCreate(RoleBase):
pass
class Role(RoleBase):
id: int
class PermissionBase(BaseModel):
permission_name: str
class PermissionCreate(PermissionBase):
pass
class Permission(PermissionBase):
id: int