-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAbstractPersistence.py
More file actions
287 lines (238 loc) · 9.07 KB
/
Copy pathAbstractPersistence.py
File metadata and controls
287 lines (238 loc) · 9.07 KB
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
"""Methods for Persistence classes to implement"""
# Copyright (c) David Wilson 2015
# Icarus is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Icarus is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with Icarus. If not, see <http://www.gnu.org/licenses/>.
class AbstractPersistence(object):
"""Provides a list of methods for persistence objects to implement."""
#Games
def add_game(self, game, user_id):
"""Add a single game.
:param params: An object of type Game
:param user_id: The id of the current user (actual id rather than username)
:returns: None
"""
pass
def count_games(self, user_id):
"""Counts the games in the user's collection.
:param user_id: The uuid of the current user.
:returns: The number of games in the user's collection
"""
pass
def delete_game(self, game, user_id):
"""Delete the given game if it belongs to the given user
:param game_id: An object of type Game -- the game to be deleted
:param user_id: A string containing the uuid of the given user
:returns: None
"""
pass
def get_all_games(self, params):
"""Gets a list of games.
:param params: An object of type GetGamesInteractorParams
:returns: A list of Game
"""
pass
def get_all_games_for_platform(self, params):
"""Gets a list of games for a platform.
:param params: An object of type GetGamesInteractorParams
:returns: A list of Game
"""
pass
def get_game(self, game_id, user_id):
"""Gets a specific game if it matches the given user
:param game_id: A string containing the uuid of the game
:param user_id: A string containing the uuid of the given user
:returns: An object of type Game
"""
pass
def update_game(self, game):
"""Update the given game if it belongs to the given user
:param game_id: An object of type Game -- the game to be updated
:param user_id: A string containing the uuid of the given user
:returns: None
"""
pass
#Genres
def add_genre(self, genre):
"""Add a genre
:param genre: An object of type Genre. The genre to be added.
"""
pass
def delete_genre(self, genre_id):
"""Delete a genre.
:param genre_id: The ObjectId of the genre to be deleted.
:returns: None
"""
pass
def get_genre_details(self, genre_id):
"""Get the details of a genre.
:param genre_id: The object id of the genre to be retrieved.
:returns: An object of type Genre containing the genre.
"""
pass
def get_genres(self):
"""Get all genres.
:returns: A list of type Genre that contains all genres in the system.
"""
pass
def update_genre(self, genre):
"""Update the details of a genre
:param genre: An object of type genre. The genre to be updated.
"""
pass
#Hardware
def add_hardware_type(self, hardware_type):
"""Add a hardware type.
:param hardware_type: An object of type HardwareType. The hardware type to add.
"""
pass
def count_hardware(self, user_id):
"""Counts the items of hardware in the user's collection
:param user_id: The uuid of the current user.
:returns: The number of items of hardware
"""
pass
def count_hardware_types(self):
"""Counts the number of hardware types in the system
:returns: The number of hardware types in the system
"""
pass
def delete_hardware(self, hardware_id, user_id):
"""Delete the given item of hardware.
:param hardware_id: The uuid of the item of hardware to be deleted
:param user_id: The uuid of the current user
"""
pass
def delete_hardware_type(self, hardware_type):
"""Delete the given hardware type.
:param hardware_type: The hardware type to be deleted
"""
pass
def get_hardware_details(self, platform_id, user_id):
"""Gets the details of a specific item of hardware.
param hardware_id: The uuid of the item of hardware to retrieve.
param user_id: The uuid of the current user.
returns: An instance of Hardware containing the requested item of hardware.
"""
pass
def get_hardware_list(self, params):
"""Get a list of all hardware in the user's collection
param params: An instance of GetHardwareListInteractorParams
returns: A list of instances of Hardware
"""
pass
def get_hardware_list_for_platform(self, params):
"""Get a list of all hardware for a platform in the user's collection
:param params: An instance of GetHardwareListInteractorParams
:returns: A list of instances of Hardware
"""
pass
def get_hardware_type(self, hardware_type):
"""Get a specific hardware type record.
:param hardware_type: An instance of HardwareType. The hardware type to get.
:return: An instance of HardwareType. The requested hardware type.
"""
pass
def get_hardware_types_list(self):
"""Gets the list of hardware types
:returns: A list of objects of type HardwareType containing the list of hardware.
"""
pass
def save_hardware(self, hardware, user_id):
"""Save an item of hardware.
:param hardware: An instance of Hardware. The item of hardware to be saved.
:param user_id: The uuid of the user whose collection the item of hardware should be added
to.
:returns: None
"""
pass
def update_hardware(self, hardware, user_idx):
"""Update the given item of hardware
:param hardware: An instance of Hardware. The item of hardware to be updated.
:param user_id: The uuid of the current user.
:returns: None
"""
pass
def update_hardware_type(self, hardware_type):
"""Update the given hardware type
:param hardware_type: The hardware type to be updated
"""
pass
#Platforms
def add_platform(self, platform):
"""Add a platform
:param platform: An object of type platform. The platform to be added.
"""
pass
def delete_platform(self, platform):
"""Delete a platform
:param platform: An object of type platform. The platform to be deleted.
"""
pass
def get_platform(self, platform_id):
"""Get a platform
:param platform_id: The uuid of a platform
:returns: an object of type platform containing the requested platform
"""
pass
def get_platforms(self):
"""Get a list of platforms
:returns: A list of type Platform of all stored platforms
"""
pass
def update_platform(self, platform):
"""Update the details of a platform
:param platform: An object of type platform. The platform to be updated.
"""
pass
#Search
def search(self, search_term, sort_field, sort_dir, user_id):
"""Search the games collection
:param search_term: The term to do the search upon
:param sort_field: The field to sort results by
:param sort_dir: The direction to sort results in
:param user_id: The uuid of the current user
:returns: the search results
"""
pass
#Users
def add_user(self, user):
"""Add a user
:param user: An object of type User. The user to add.
"""
pass
def change_password(self, user):
"""Change a user's password
:param user: An object of type user. The user whose password is to be changed.
The password property is the new password.
"""
pass
def delete_user(self, user):
"""Delete a user
:param user: An object of type user. Contains the id of the user to be deleted.
"""
pass
def get_all_users(self):
"""Get all users
:returns: A list of User. All users.
"""
pass
def get_user(self, user):
"""Get a user
:param user: An object of type User. The user to get.
:returns: An object of type User. The desired user.
"""
pass
def update_user(self, user):
"""Update the details of a user
:param user: An object of type User. The id field is set to the id of the user to update.
The rest of the fields contain the new values.
"""
pass