diff --git a/codedigger/lists/serializers.py b/codedigger/lists/serializers.py index 69f5cbd..669245f 100644 --- a/codedigger/lists/serializers.py +++ b/codedigger/lists/serializers.py @@ -212,8 +212,8 @@ class Meta: class EditorListSerializer(serializers.Serializer): - # slug = serializers.CharField(required=True) - # friend = serializers.CharField(required=True) + slug = serializers.CharField(required=True) + friend = serializers.CharField(required=True) class Meta: model = Editor diff --git a/docs/routes/doc.html b/docs/routes/doc.html index c8b7f0e..e591ab4 100755 --- a/docs/routes/doc.html +++ b/docs/routes/doc.html @@ -80,6 +80,16 @@

Codeforces

Lists

+ +
+
+ POST +
+ + /lists/add + +
+
diff --git a/docs/routes/lists/AddUserToEditTheList.html b/docs/routes/lists/AddUserToEditTheList.html new file mode 100644 index 0000000..f3bc948 --- /dev/null +++ b/docs/routes/lists/AddUserToEditTheList.html @@ -0,0 +1,197 @@ + + + + + + + + + + Codedigger REST API DOC - add + + + + + + + + +
+
+
+ +
+
+

Title

+

To add the user's friends to edit the list +

+
+
+

URL

+
+
+ GET +
+ + /lists/add + +
+
+
+

Headers

+

+

+ + + + + + + + + + + + + +
Header NameRequiredTypeDescription
Authorizationtruestring + Bearer {Token} +
+
+
+

URL Parameters

+

+ For GET Request. + If URL params exist, specify them in accordance with name mentioned in URL section. + Mention if is required or optional. Document data constraints. +

+ + + + + + + + + + + + + + + + + + + +
Param NameRequiredTypeDescription
friendtruestring + friend=username of the friend that need's edit access. +
slugtruestring + slug=list name that the user wants to give edit access. +
+
+
+

Success Response

+

+ Return the staus of the request along with message. +

+

+ Status Code: 200 +

+

+ Sample Response: +

+
+            
+            	{
+                    "status": "OK",
+                    "result": "User has been added to the list"
+                }
+            
+          
+
+
+

Error Response

+

+ Reason of Error: If the user is not Authentication. +

+

+ Status Code: 400 BAD REQUEST +

+

+ Error Response: +

+
+            
+                {
+                    "status": "FAILED",
+                    "error": "Authentication credentials were not provided"
+                }
+            
+          
+
+
+

Sample Call

+

+ Just a sample call to your endpoint in a runnable format + ($.ajax call or a curl request) - this makes life easier and more predictable. +

+
+            
+              curl -X POST "https://api.codedigger.tech/lists/add"
+            
+          
+
+
+

Notes

+

+ This is where all uncertainties, commentary, discussion etc.., can go. + Mention timestamp and identify yourself when leaving comments here. +

+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/docs/routes/lists/EditorAccessList.html b/docs/routes/lists/EditorAccessList.html new file mode 100644 index 0000000..13f8c6e --- /dev/null +++ b/docs/routes/lists/EditorAccessList.html @@ -0,0 +1,262 @@ + + + + + + + + + Codedigger REST API DOC - Editor Access to List + + + + + + + +
+ +
+ +
+
+

Add Problem to List

+

+ Adding a problem to a list is handled by this API call. +

+
+
+

URL

+
+
+ POST +
+ + /lists/userlist/add + +
+
+
+

Headers

+ + + + + + + + + + + + + +
Header NameRequiredTypeDescription
Authorizationtruestring + Bearer {Token} +
+
+

Data Params

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Param NameRequiredTypeDescription
prob_idtruestring + id of the problem +
slugtruestring + slug of the list problem is added to +
platformtruestring + platform of the problem +
descriptionfalsestring + description of the problem +
+
+
+

Success Response

+

+ Status Code: 200 +

+

+ Sample Response: +

+
+            
+    {
+        "status": "OK",
+        "result": "Given problem has been added to the list"
+    }
+            
+          
+
+
+

Error Response 1

+

+ Only authorized users can add problems to any list. +

+

+ Status Code: 401 UNAUTHORIZED +

+

+ Error Response: +

+
+            
+    {
+        "status": "FAILED",
+        "error": "Authentication credentials were not provided"
+    }
+            
+          
+

Error Response 2

+

+ Problem ID, List ID(Slug), Platform and Description are required fields. +

+ Status Code: 400 BAD REQUEST +

+

+ Error Response: +

+
+            
+    {
+        "status": "FAILED",
+        "error": "prob_id or slug or platform or description not provided"
+    }
+            
+          
+

Error Response 3

+

+ The problem ID and platform should be valid. +

+ Status Code: 400 BAD REQUEST +

+

+ Error Response: +

+
+            
+    {
+        "status": "FAILED",
+        "error": "Problem with the given prob_id and platform does not exist"
+    }
+            
+          
+

Error Response 4

+

+ The List ID(slug) should be valid and should exist. +

+ Status Code: 400 BAD REQUEST +

+

+ Error Response: +

+
+            
+    {
+        "status": "FAILED",
+        "error": "List with the provided slug does not exist"
+    }
+            
+          
+

Error Response 5

+

+ The same problem cannot be added to the list twice. +

+ Status Code: 400 BAD REQUEST +

+

+ Error Response: +

+
+            
+    {
+        "status": "FAILED",
+        "error": "Problem with the given prob_id and platform already exists within the list"
+    }
+            
+          
+
+
+

Sample Call

+
+            
+    curl -X POST "http://api.codedigger.tech/lists/userlist/add" \
+    -H "accept: application/json" \
+    -H "Authorization: Bearer {Access Token}" \
+    -H "Content-Type: application/json" \
+    -d "{  \"prob_id\": \"{prob_id}\",  \"slug\": \"{slug}\",  \"platform\": \"{platform}\",  \"description\": \"{description}\"}"
+            
+          
+
+
+

Notes

+

+

+
+
+
+ + + + + + + diff --git a/docs/routes/lists/UserlistAddProblemView.html b/docs/routes/lists/UserlistAddProblemView.html index 4fd180c..13d4cf0 100644 --- a/docs/routes/lists/UserlistAddProblemView.html +++ b/docs/routes/lists/UserlistAddProblemView.html @@ -43,9 +43,10 @@

Codedigger {API} <
  • @sreelayavuyyuru
  • @shivamsinghal1
  • +
  • @jyothiprakash

-

Last Updated: Oct 26, 2021

+

Last Updated: Jan 24, 2022