{"info":{"_postman_id":"7f12eb9c-9ca3-4d0e-a797-c5c3598bbd6e","name":"LearningGate","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"description":"<html><head></head><body></body></html>","owner":"19893374","collectionId":"7f12eb9c-9ca3-4d0e-a797-c5c3598bbd6e","publishedId":"UVsFzUNU","public":true,"customColor":{"top-bar":"303030","right-sidebar":"303030","highlight":"EF5B25"},"publishDate":"2022-03-10T04:05:05.000Z"},"item":[{"name":"View Login Page","id":"d3be4360-e233-448d-a48f-114b0f06fbef","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[]},"isInherited":false},"method":"GET","header":[],"body":{"mode":"raw","raw":"","options":{"raw":{"language":"json"}}},"url":"localhost:3000/view/login","description":"<p>Return the login.html file, does not need the request body.</p>\n","urlObject":{"port":"3000","path":["view","login"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"d3be4360-e233-448d-a48f-114b0f06fbef"},{"name":"Login","id":"c01e460d-3f18-4cb4-a956-45ffde301802","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[]},"isInherited":false},"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"username\": \"d1\",\r\n    \"password\": \"1\"\r\n}","options":{"raw":{"language":"json"}}},"url":"localhost:3000/api/login","description":"<p>Need \"username\", \"password\" from resquest.body.</p>\n<p>If it success, it returns 200 and json file with \"username\" and \"isInstructor\".</p>\n<p>If it has wrong username or password, it returns 400 and json file with error message.</p>\n","urlObject":{"port":"3000","path":["api","login"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"c01e460d-3f18-4cb4-a956-45ffde301802"},{"name":"Sign out","id":"9acee510-9d04-40e0-975b-e126a17e7b59","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"username\": \"d1\"\r\n}","options":{"raw":{"language":"json"}}},"url":"localhost:3000/api/signout","description":"<p>Need \"username\" from request.body.</p>\n<p>It will return 200 status with a success message.</p>\n<p>If the user have not signed in, it still return 200 status and message \"no sign in session with: username\" .</p>\n","urlObject":{"port":"3000","path":["api","signout"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"9acee510-9d04-40e0-975b-e126a17e7b59"},{"name":"Sign Up","id":"196a5749-cb63-487d-a27b-53703456e00e","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"username\":\"admin\",\r\n    \"password\":\"1\",\r\n    \"isInstructor\":false\r\n}","options":{"raw":{"language":"json"}}},"url":"localhost:3000/api/signup","description":"<p>Need request.body with this schema:</p>\n<p>username: String ,  password: String,  name: { type: String, default: \"\" },  email: { type: String, default: \"\" },  dob: Date,  balance: { type: Number, min: 0, default: 0 },  isInstructor: { type: Boolean, default: false }  </p>\n<p>For testing purpose, username, password and isInstructor is enough from the body.</p>\n<p>If it success, it returns 200 and json file with \"username\" and \"isInstructor\".</p>\n<p>If it has wrong username or password, it returns 400 and json file with error message.</p>\n","urlObject":{"port":"3000","path":["api","signup"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"196a5749-cb63-487d-a27b-53703456e00e"},{"name":"Get User Balance","id":"e2a974f1-1de5-4e12-bb69-6749e51b702f","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"username\":\"d1\"\r\n}","options":{"raw":{"language":"json"}}},"url":"localhost:3000/api/getbalance","description":"<p>Need \"username\" from request.body.</p>\n<p>If user have signed in, It will return 200 status and json file with \"balance\".</p>\n<p>If the user have not signed in, it will return 400 status and json file with error message.</p>\n","urlObject":{"port":"3000","path":["api","getbalance"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"e2a974f1-1de5-4e12-bb69-6749e51b702f"},{"name":"View Signup Page","id":"4cac062a-ce07-4053-a480-7cdeb3816e59","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"body":{"mode":"raw","raw":"","options":{"raw":{"language":"json"}}},"url":"localhost:3000/view/signup","description":"<p>Return the signup.html file, does not need the request body.</p>\n","urlObject":{"port":"3000","path":["view","signup"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"4cac062a-ce07-4053-a480-7cdeb3816e59"},{"name":"Create Course","id":"4a77fb1a-4637-4914-9f78-c33eb2a3f778","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"username\": \"d6\",\r\n    \"title\": \"Math\",\r\n    \"enrollFee\": 1\r\n}","options":{"raw":{"language":"json"}}},"url":"localhost:3000/api/createcourse","description":"<p>Need request.body with this schema:</p>\n<p>title:{type: String, required: true}, instructor: { type: String, require: true }, balance: { type: Number, min: 0, default: 0 }, enrollFee:{type: Number, min:0,default:0}, tags: { type: [allTags], default: [] }, open: { type: Boolean, default: true },</p>\n<p>For testing purpose, username and title is enough from the body.</p>\n<p>If it success, it returns 200 and json file with \" courseID\", \"title\" and \"instructor\".</p>\n<p>If the user have not signed in, it will return 400 status and json file with error message .</p>\n<p>If the user is not an instructor, it will return 400 status and json file with error message .</p>\n<p>It will also add a new document in courseMember collection:</p>\n<p>courseID: { unique: true, type: String }, username: { type: String }, isInstructor: { type: Boolean, default: false },</p>\n","urlObject":{"port":"3000","path":["api","createcourse"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"4a77fb1a-4637-4914-9f78-c33eb2a3f778"},{"name":"View User Balance Page","id":"e882aced-1254-4fc8-9ade-5ac57190e08d","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"localhost:3000/view/userbalance","description":"<p>Return the viewbalance.html file, does not need the request body.</p>\n","urlObject":{"port":"3000","path":["view","userbalance"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"e882aced-1254-4fc8-9ade-5ac57190e08d"},{"name":"View Landing Page","id":"dd2226dd-1447-43c1-ba85-1fd0c17090da","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"localhost:3000/","description":"<p>Return the landingpage.html file, does not need the request body.</p>\n","urlObject":{"port":"3000","path":[""],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"dd2226dd-1447-43c1-ba85-1fd0c17090da"},{"name":"List All Course ","id":"aaf6388b-afc0-4939-a6a6-6b733c912454","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"localhost:3000/view/getallcourse","description":"<p>Return the list of all course in json file, does not need the request body.</p>\n","urlObject":{"port":"3000","path":["view","getallcourse"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"aaf6388b-afc0-4939-a6a6-6b733c912454"},{"name":"Add Balance","id":"40e8a27c-0425-4771-9107-5d0437b5f396","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"username\": \"d1\",\r\n    \"amount\": \"10.2\"\r\n}","options":{"raw":{"language":"json"}}},"url":"localhost:3000/api/addbalance","description":"<p>Need \"username\" and \"amount\" from req.body</p>\n<p>User must already signed in and amount &gt;=0</p>\n<p>Upon success, It will return 200 status and json file with \"username\" and \"balance\".</p>\n","urlObject":{"port":"3000","path":["api","addbalance"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"40e8a27c-0425-4771-9107-5d0437b5f396"},{"name":"View Course","id":"32e7c25f-2c3a-4889-8652-83b6a18cec87","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"body":{"mode":"raw","raw":"{\r\n    \"course_id\": \"622974ae64cf4df809d29480\"\r\n}","options":{"raw":{"language":"json"}}},"url":"localhost:3000/view/course","description":"<p>Require Course's ID as parameter in the URI</p>\n<p>It returns course object with all of its information</p>\n","urlObject":{"port":"3000","path":["view","course"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"32e7c25f-2c3a-4889-8652-83b6a18cec87"},{"name":"Enroll in course","id":"c5fa58ee-6ca5-4258-ada5-49aa68f06243","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"username\": \"d1\",\r\n    \"course_id\":\"62658fc059bdca630f2d8031\"\r\n}","options":{"raw":{"language":"json"}}},"url":"localhost:3000/api/enroll/course/","description":"<p>Need \"username\" and \"course_id\" from req.body  </p>\n<p>It returns error with message when:</p>\n<ul>\n<li>User is an instructor</li>\n<li>Cannot find course with course_id</li>\n<li>User insufficient balance</li>\n<li>User has not logged in</li>\n<li>Cannot find admin account (db error)</li>\n</ul>\n<p>If no error, it changes user balance, changes course balance and numOfStudent, creates transaction document to course and to admin</p>\n","urlObject":{"port":"3000","path":["api","enroll","course",""],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"c5fa58ee-6ca5-4258-ada5-49aa68f06243"},{"name":"List of student","id":"5ad7ce8c-42cd-4e5b-b254-dcc33fcc398d","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"body":{"mode":"raw","raw":"{\r\n    \"course_id\": \"62658fc059bdca630f2d8031\"\r\n}","options":{"raw":{"language":"json"}}},"url":"localhost:3000/view/course/listofstudent","urlObject":{"port":"3000","path":["view","course","listofstudent"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"5ad7ce8c-42cd-4e5b-b254-dcc33fcc398d"}]}