-
Notifications
You must be signed in to change notification settings - Fork 1
/
schemas.py
159 lines (119 loc) · 3.17 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
from datetime import datetime
from turtle import title
from pydantic import BaseModel, Field
from typing import List,Union
from uuid import uuid4, UUID
class User_schema(BaseModel):
name:str
email:str
password:str
subscription_expires:datetime
class Config:
orm_mode=True
class Subscription(BaseModel):
user_id:UUID = Field(default_factory=uuid4)
start_timestamp : datetime
end_timestamp:datetime
class Config:
orm_mode=True
class Review_schema(BaseModel):
#Get the user-id of logged in user from the FastApi and add it to the table using add()
# title:str
stars:float
comments:str
created_timestamp:datetime
class Config:
orm_mode=True
class Genre_schema(BaseModel):
genre_name:str
class Config:
orm_mode=True
class Movie_schema(BaseModel):
title:str
description:str
language:str
release_date:datetime
director:str
genres:list[str]
class Config:
orm_mode=True
class User_response_schema(BaseModel):
user_id:UUID = Field(default_factory=uuid4)
name:str
email:str
created_at:datetime
# ratings:List[Review_schema]
subscription:List[Subscription]
class Config:
orm_mode=True
class Movie_response_schema(BaseModel):
movie_id:UUID = Field(default_factory=uuid4)
title:str
description:str
language:str
release_date:datetime
director:str
genres:List[Genre_schema]
ratings:list[Review_schema]
class Config:
orm_mode=True
class Token(BaseModel):
access_token: str
token_type: str
class TokenData(BaseModel):
username: Union[str, None] = None
# Schemas for getting custom inputs
class Watch(BaseModel):
title:str
class Config:
orm_mode=True
class Login(BaseModel):
username:str
password:str
class Config:
orm_mode=True
class Rating(BaseModel):
created_timestamp:datetime
rating_id:UUID = Field(default_factory=uuid4)
user_id:UUID = Field(default_factory=uuid4)
stars:float
comments:str
class Config:
orm_mode=True
class GMovie_schema(BaseModel):
movie_id:UUID = Field(default_factory=uuid4)
title:str
description:str
language:str
release_date:datetime
director:str
genres:List[Genre_schema]
ratings:list[Review_schema]
class Config:
orm_mode=True
class Get_rating(BaseModel):
created_timestamp:datetime
rating_id:UUID = Field(default_factory=uuid4)
movie_id:UUID = Field(default_factory=uuid4)
stars:float
comments:str
movie=Movie_response_schema
class Config:
orm_mode=True
class Get_movie_response_schema(BaseModel):
# name:str
movie_id:UUID = Field(default_factory=uuid4)
title:str
description:str
language:str
release_date:datetime
director:str
genres:List[Genre_schema]
ratings:List[Rating]
class Config:
orm_mode=True
class Test(BaseModel):
title:str
Rating:Review_schema
class Config:
orm_mode=True