-
Notifications
You must be signed in to change notification settings - Fork 2
/
schemas.py
139 lines (118 loc) · 3.29 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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
from datetime import date
import json
from pydantic import BaseModel, Json
from typing import Union, List
from uuid import UUID
################################################
## DATABASE SCHEMAS ##
################################################
class User(BaseModel):
user_id: UUID
reset_id: UUID
create_date: date
# get information
email: str
password_hash: str
is_confirmed: bool = False
# name/language
first_name: Union[str, None] = None
last_name: Union[str, None] = None
language: Union[str, None] = 'en-us'
# personalized settings
last_update: Union[date, None] = None
last_email: Union[date, None] = None
last_login: Union[date, None] = None
last_login_city: Union[str, None] = None
last_login_state: Union[str, None] = None
last_login_country: Union[str, None] = None
last_login_ip: Union[str, None] = None
login_number: int
signup_ip: Union[str, None] = None
image_link: Union[str, None] = None
phone_number: Union[str, None] = None
gender: Union[str, None] = None
age: float
# assistant default settings
sound: Union[str, None] = None
voice: Union[str, None] = None
response_type: Union[str, None] = None
audio_delete: Union[bool, None] = False
class Config:
orm_mode = True
class Session(BaseModel):
session_id: UUID
user_id: UUID
create_date: date
class Config:
orm_mode = True
class Query(BaseModel):
query_id: UUID
session_id: UUID
user_id: UUID
create_date: date
features: Union[str, None] = None
transcript: Union[str, None] = None
bucket: str
rating: Union[int, None] = None
response: Union[str, None] = None
response_method: Union[str, None] = None
language: Union[str, None] = None
city: Union[str, None] = None
state: Union[str, None] = None
country: Union[str, None] = None
# settings
audio_delete: Union[bool, None] = False
class Config:
orm_mode = True
class Integration(BaseModel):
integration_id: UUID
create_date: date
name: Union[str, None] = None
credentials: Union[str, None] = None
class Config:
orm_mode = True
################################################
## OTHER SCHEMAS ##
################################################
'''
A place for all other pydantic schemas.
'''
class HTTPError(BaseModel):
detail: str
class Config:
schema_extra = {
"example": {"detail": "HTTPException raised."},
}
class Response_Message(BaseModel):
message: str
# user logins
class CreateUser(BaseModel):
email: str
password: str
confirm_password: str
class CreateUserResponse(BaseModel):
message: str
user_id: UUID
class LoginUser(BaseModel):
username: str
password: str
# create api keys
class LoginResponse(BaseModel):
access_token: str
refresh_token: str
# token for requests
class ApiToken(BaseModel):
token_id: str
class QueryRate(BaseModel):
query_id: UUID
rating: Union[int, None]
class QueryRateString(BaseModel):
query_id: str
rating: int
class UpdateUser(BaseModel):
first: Union[str, None]
last: Union[str, None]
language: str = 'en-us'
sound: str
voice: str
response_type: str