Coverage for src/dto/profile_dto.py : 100%
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1from flask_restx import Namespace, fields
3from .base import ProfileBaseObj, GroupBaseObj, ProfileItemObj, messageObj, paginationObj, GenreBaseObj, MetaProfileContentBaseObj, MetaProfileApplicationItemObj, MetaProfileBookItemObj, MetaProfileGameItemObj, MetaProfileMovieItemObj, MetaProfileSerieItemObj, MetaProfileTrackItemObj, GenreBase2Obj, ResultApplicationItemObj, ResultBookItemObj, ResultGameItemObj, ResultMovieItemObj, ResultSerieItemObj, ResultTrackItemObj
6class ProfileDto:
7 api = Namespace("profile", description="Profile related operations.")
9 # Objects
10 api.models[GenreBaseObj.name] = GenreBaseObj
11 genre_base = GenreBaseObj
13 api.models[MetaProfileContentBaseObj.name] = MetaProfileContentBaseObj
14 meta_profile_content_base = MetaProfileContentBaseObj
16 api.models[MetaProfileApplicationItemObj.name] = MetaProfileApplicationItemObj
17 meta_profile_application_item = MetaProfileApplicationItemObj
19 api.models[MetaProfileBookItemObj.name] = MetaProfileBookItemObj
20 meta_profile_book_item = MetaProfileBookItemObj
22 api.models[MetaProfileGameItemObj.name] = MetaProfileGameItemObj
23 meta_profile_game_item = MetaProfileGameItemObj
25 api.models[MetaProfileMovieItemObj.name] = MetaProfileMovieItemObj
26 meta_profile_movie_item = MetaProfileMovieItemObj
28 api.models[MetaProfileSerieItemObj.name] = MetaProfileSerieItemObj
29 meta_profile_serie_item = MetaProfileSerieItemObj
31 api.models[MetaProfileTrackItemObj.name] = MetaProfileTrackItemObj
32 meta_profile_track_item = MetaProfileTrackItemObj
34 api.models[ProfileBaseObj.name] = ProfileBaseObj
35 profile_base = ProfileBaseObj
37 api.models[ProfileItemObj.name] = ProfileItemObj
38 profile_item = ProfileItemObj
40 api.models[GenreBase2Obj.name] = GenreBase2Obj
41 liked_genres2_base = GenreBase2Obj
43 api.models[ResultApplicationItemObj.name] = ResultApplicationItemObj
44 result_app_item = ResultApplicationItemObj
46 api.models[ResultBookItemObj.name] = ResultBookItemObj
47 result_book_item = ResultBookItemObj
49 api.models[ResultGameItemObj.name] = ResultGameItemObj
50 result_game_item = ResultGameItemObj
52 api.models[ResultMovieItemObj.name] = ResultMovieItemObj
53 result_movie_item = ResultMovieItemObj
55 api.models[ResultSerieItemObj.name] = ResultSerieItemObj
56 result_serie_item = ResultSerieItemObj
58 api.models[ResultTrackItemObj.name] = ResultTrackItemObj
59 result_track_item = ResultTrackItemObj
61 # Responses
62 data_resp = api.clone(
63 "Profile Data Response",
64 messageObj,
65 {
66 "profile": fields.Nested(profile_item)
67 }
68 )
70 data_resp_list = api.clone(
71 "Profile List Data Response",
72 messageObj,
73 {
74 "profile": fields.List(fields.Nested(profile_item))
75 }
76 )
78 liked_genres_resp_list = api.clone(
79 "Profile liked genres list",
80 messageObj,
81 {
82 "profile": fields.List(fields.Nested(liked_genres2_base))
83 }
84 )
86 search_data_resp = api.clone(
87 "Profile Research Data Response",
88 paginationObj,
89 {
90 "content": fields.List(fields.Nested(profile_base))
91 }
92 )
93 genres_resp = api.clone(
94 "Content genres Data Response",
95 messageObj,
96 {
97 "content": fields.List(fields.Nested(genre_base))
98 }
99 )
101 meta_application_resp = api.clone(
102 "MetaProfileapplication Data Response",
103 messageObj,
104 {
105 "content": fields.List(fields.Nested(meta_profile_application_item))
106 }
107 )
109 meta_book_resp = api.clone(
110 "MetaProfilebook Data Response",
111 messageObj,
112 {
113 "content": fields.List(fields.Nested(meta_profile_book_item))
114 }
115 )
117 meta_game_resp = api.clone(
118 "MetaProfilegame Data Response",
119 messageObj,
120 {
121 "content": fields.List(fields.Nested(meta_profile_game_item))
122 }
123 )
125 meta_movie_resp = api.clone(
126 "MetaProfilemovie Data Response",
127 messageObj,
128 {
129 "content": fields.List(fields.Nested(meta_profile_movie_item))
130 }
131 )
133 meta_serie_resp = api.clone(
134 "MetaProfileserie Data Response",
135 messageObj,
136 {
137 "content": fields.List(fields.Nested(meta_profile_serie_item))
138 }
139 )
141 meta_track_resp = api.clone(
142 "MetaProfiletrack Data Response",
143 messageObj,
144 {
145 "content": fields.List(fields.Nested(meta_profile_track_item))
146 }
147 )
149 result_app_resp = api.clone(
150 "Result app_ Data resp",
151 messageObj,
152 {
153 "content": fields.List(fields.Nested(result_app_item))
154 }
155 )
156 result_book_resp = api.clone(
157 "Result book Data resp",
158 messageObj,
159 {
160 "content": fields.List(fields.Nested(result_book_item))
161 }
162 )
163 result_game_resp = api.clone(
164 "Result game Data resp",
165 messageObj,
166 {
167 "content": fields.List(fields.Nested(result_game_item))
168 }
169 )
170 result_movie_resp = api.clone(
171 "Result movi Data resp",
172 messageObj,
173 {
174 "content": fields.List(fields.Nested(result_movie_item))
175 }
176 )
177 result_serie_resp = api.clone(
178 "Result seri Data resp",
179 messageObj,
180 {
181 "content": fields.List(fields.Nested(result_serie_item))
182 }
183 )
184 result_track_resp = api.clone(
185 "Result trac Data resp",
186 messageObj,
187 {
188 "content": fields.List(fields.Nested(result_track_item))
189 }
190 )
192 # Expected data
193 profile_data = api.model(
194 "ProfileDataExpected",
195 {
196 "profilename": fields.String(min=4, max=15)
197 },
198 )
200 bad_recommendation = api.model(
201 "ApplicationMetaExpected",
202 {
203 "reason_categorie": fields.List(fields.String),
204 "reason": fields.List(fields.String)
205 }
206 )
208 content_meta = api.model(
209 "ContentProfileMetaExpected",
210 {
211 "rating": fields.Integer(min=0, max=5, required=True),
212 "last_rating_date": fields.DateTime(required=True),
213 "review_see_count": fields.Integer(min=0, required=True),
214 "last_review_see_date": fields.DateTime(required=True),
215 "count": fields.Integer(min=0, required=True),
216 "last_count_increment": fields.DateTime(required=True),
217 }
218 )