You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: app/api/dao/user.py
+51-41Lines changed: 51 additions & 41 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
fromoperatorimportitemgetter
3
3
fromhttpimportHTTPStatus
4
4
fromtypingimportDict
5
-
fromflask_restplusimportmarshal
5
+
fromflask_restximportmarshal
6
6
fromsqlalchemyimportfunc
7
7
8
8
fromappimportmessages
@@ -34,12 +34,12 @@ class UserDAO:
34
34
@staticmethod
35
35
defcreate_user(data: Dict[str, str]):
36
36
"""Creates a new user.
37
-
37
+
38
38
Creates a new user with provided data.
39
-
39
+
40
40
Arguments:
41
41
data: A list containing the user's name, username, password, and email, as well as recognition that they have read and agree to the Terms and Conditions.
42
-
42
+
43
43
Returns:
44
44
A tuple with two elements. The first element is a dictionary containing a key 'message' containing a string which indicates whether or not the user was created successfully. The second is the HTTP response code.
Deletes the specified user and removes them from the directory, with checks to make sure that the user exists and is not the only administrator.
78
-
78
+
79
79
Arguments:
80
80
user_id: The ID of the user to be deleted.
81
-
82
-
Returns:
81
+
82
+
Returns:
83
83
A tuple with two elements. The first element is a dictionary containing a key 'message' containing a string which indicates whether or not the user was created successfully. The second is the HTTP response code.
""" Updates the profile of a specified user with new data.
200
-
200
+
201
201
Replaces old data items with new ones in the provided data list, with a check for overlap between users in username and a check that a user with the specified ID exists
202
-
202
+
203
203
Arguments:
204
204
user_id: The ID of the user whose data will be updated.
205
205
data: A list containing the user's information such as name, bio, location, etc.
206
-
206
+
207
207
Returns:
208
208
A message that indicates whether the update was successful or not and a second element which is the HTTP response code.
0 commit comments