{"info":{"_postman_id":"d2fa6660-282d-4545-a804-bf734c5b9346","name":"User","description":"<html><head></head><body><p>The Users Collection API provides endpoints for managing user-related operations within the Newspaper Backend system. Utilize these endpoints to perform user authentication, registration, profile updates, and account deletion.</p>\n<p><strong>Base URL:</strong> <code>https://newspaper.azurewebsites.net/api/v1/user</code></p>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"owner":"32008492","collectionId":"d2fa6660-282d-4545-a804-bf734c5b9346","publishedId":"2sA2xiWXk9","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"FF6C37"},"publishDate":"2024-03-11T21:50:37.000Z"},"item":[{"name":"Register","event":[{"listen":"test","script":{"id":"2b7e696d-5c25-49fc-9e40-dc0737e8726c","exec":["const reqBody = JSON.parse(pm.request.body.raw)\r","const {email,password} = reqBody\r","\r","pm.collectionVariables.set(\"email\", email)\r","pm.collectionVariables.set(\"password\", password)"],"type":"text/javascript"}}],"id":"0fd4322b-0ed8-4f7c-b68a-137e316134e6","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"email\": \"Mya.Fisher34@hotmail.com\",\r\n    \"password\": \"3PNN_JQOiK6yxcO\"\r\n}","options":{"raw":{"language":"json"}}},"url":"{{base_user}}/register","description":"<p>This endpoint allows users to register with the application. Upon a successful registration, the user will receive a response containing user details and a refresh token.</p>\n<h3 id=\"request-body\">Request Body</h3>\n<ul>\n<li><strong>email</strong> (string, required): The email address of the user.</li>\n<li><strong>password</strong> (string, required): The password for the user account.</li>\n</ul>\n<h3 id=\"response\">Response</h3>\n<ul>\n<li><strong>statusCode</strong> (integer): The status code of the response.</li>\n<li><strong>data</strong> (object): An object containing user details, including email, articles, favorite categories, ID, creation and update timestamps, and a refresh token.</li>\n<li><strong>message</strong> (string): A message related to the response.</li>\n<li><strong>success</strong> (boolean): Indicates the success status of the request.</li>\n</ul>\n","urlObject":{"path":["register"],"host":["{{base_user}}"],"query":[],"variable":[]}},"response":[{"id":"b55ed56a-f370-4b8c-b34b-62436f720116","name":"201 Created","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"email\": \"Freeda.Heathcote94@yahoo.com\",\r\n    \"password\": \"_kGBFBCfJKk0R6m\"\r\n}","options":{"raw":{"language":"json"}}},"url":"{{base_user}}/register"},"status":"Created","code":201,"_postman_previewlanguage":"json","header":[{"key":"X-Powered-By","value":"Express"},{"key":"Set-Cookie","value":"refreshToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY1ZWUxZWZmYTYwNzJhZGY0YjIxZGQ4YyIsImlhdCI6MTcxMDEwNDMxOSwiZXhwIjoxNzE4NzQ0MzE5fQ.MlIVBwF3evZBoD90O51C0byGkv6ODl525nz_T7ZXtUw; Path=/; HttpOnly; Secure"},{"key":"Set-Cookie","value":"accessToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY1ZWUxZWZmYTYwNzJhZGY0YjIxZGQ4YyIsImVtYWlsIjoiY2hheWFfb3NpbnNraTI3QGdtYWlsLmNvbSIsImlhdCI6MTcxMDEwNDMxOSwiZXhwIjoxNzEwMTA0MzE5fQ._MOWeTqFcfFw0rIBk2UZafNpe4ysUq489Ck1rpx0Uio; Path=/; HttpOnly; Secure"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"458"},{"key":"ETag","value":"W/\"1ca-YWUteixBtxDN41h6o8N8C4Yvezg\""},{"key":"Date","value":"Sun, 10 Mar 2024 20:58:39 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"{\n    \"statusCode\": 201,\n    \"data\": {\n        \"email\": \"chaya_osinski27@gmail.com\",\n        \"articles\": [],\n        \"fevCategory\": [],\n        \"_id\": \"65ee1effa6072adf4b21dd8c\",\n        \"createdAt\": \"2024-03-10T20:58:39.116Z\",\n        \"updatedAt\": \"2024-03-10T20:58:39.116Z\",\n        \"__v\": 0,\n        \"refreshToken\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY1ZWUxZWZmYTYwNzJhZGY0YjIxZGQ4YyIsImlhdCI6MTcxMDEwNDMxOSwiZXhwIjoxNzE4NzQ0MzE5fQ.MlIVBwF3evZBoD90O51C0byGkv6ODl525nz_T7ZXtUw\"\n    },\n    \"message\": \"User registered successfully\",\n    \"success\": true\n}"},{"id":"73478393-0cf5-4da1-890e-9ec1b7c627d7","name":"400 Password Missing","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"email\": \"Ray.Paucek@hotmail.com\"\r\n}\r\n   ","options":{"raw":{"language":"json"}}},"url":"{{base_user}}/register"},"status":"Bad Request","code":400,"_postman_previewlanguage":"html","header":[{"key":"X-Powered-By","value":"Express"},{"key":"Content-Security-Policy","value":"default-src 'self'"},{"key":"X-Content-Type-Options","value":"nosniff"},{"key":"Content-Type","value":"text/html; charset=utf-8"},{"key":"Content-Length","value":"1320"},{"key":"Date","value":"Sun, 10 Mar 2024 21:02:57 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"<!DOCTYPE html>\n<html lang=\"en\">\n    <head>\n        <meta charset=\"utf-8\">\n        <title>Error</title>\n    </head>\n    <body>\n        <pre>Error: Password is required\n            <br> &nbsp; &nbsp;at F:\\Personal Project\\Newspaper-Backend\\controllers\\userController.js:48:11\n            <br> &nbsp; &nbsp;at F:\\Personal Project\\Newspaper-Backend\\utils\\asyncHandler.js:3:21\n            <br> &nbsp; &nbsp;at Layer.handle [as handle_request] (F:\\Personal Project\\Newspaper-Backend\\node_modules\\express\\lib\\router\\layer.js:95:5)\n            <br> &nbsp; &nbsp;at next (F:\\Personal Project\\Newspaper-Backend\\node_modules\\express\\lib\\router\\route.js:137:13)\n            <br> &nbsp; &nbsp;at Route.dispatch (F:\\Personal Project\\Newspaper-Backend\\node_modules\\express\\lib\\router\\route.js:112:3)\n            <br> &nbsp; &nbsp;at Layer.handle [as handle_request] (F:\\Personal Project\\Newspaper-Backend\\node_modules\\express\\lib\\router\\layer.js:95:5)\n            <br> &nbsp; &nbsp;at F:\\Personal Project\\Newspaper-Backend\\node_modules\\express\\lib\\router\\index.js:281:22\n            <br> &nbsp; &nbsp;at Function.process_params (F:\\Personal Project\\Newspaper-Backend\\node_modules\\express\\lib\\router\\index.js:335:12)\n            <br> &nbsp; &nbsp;at next (F:\\Personal Project\\Newspaper-Backend\\node_modules\\express\\lib\\router\\index.js:275:10)\n            <br> &nbsp; &nbsp;at Function.handle (F:\\Personal Project\\Newspaper-Backend\\node_modules\\express\\lib\\router\\index.js:174:3)\n        </pre>\n    </body>\n</html>"},{"id":"950e3fc3-3047-41ea-a133-ab7fe0fa19b0","name":"400 Email Missing","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \r\n    \"password\": \"TAjS3Ak8Hc_rDGY\"\r\n}","options":{"raw":{"language":"json"}}},"url":"{{base_user}}/register"},"status":"Bad Request","code":400,"_postman_previewlanguage":"html","header":[{"key":"X-Powered-By","value":"Express"},{"key":"Content-Security-Policy","value":"default-src 'self'"},{"key":"X-Content-Type-Options","value":"nosniff"},{"key":"Content-Type","value":"text/html; charset=utf-8"},{"key":"Content-Length","value":"1317"},{"key":"Date","value":"Sun, 10 Mar 2024 21:03:35 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"<!DOCTYPE html>\n<html lang=\"en\">\n    <head>\n        <meta charset=\"utf-8\">\n        <title>Error</title>\n    </head>\n    <body>\n        <pre>Error: Email is required\n            <br> &nbsp; &nbsp;at F:\\Personal Project\\Newspaper-Backend\\controllers\\userController.js:45:11\n            <br> &nbsp; &nbsp;at F:\\Personal Project\\Newspaper-Backend\\utils\\asyncHandler.js:3:21\n            <br> &nbsp; &nbsp;at Layer.handle [as handle_request] (F:\\Personal Project\\Newspaper-Backend\\node_modules\\express\\lib\\router\\layer.js:95:5)\n            <br> &nbsp; &nbsp;at next (F:\\Personal Project\\Newspaper-Backend\\node_modules\\express\\lib\\router\\route.js:137:13)\n            <br> &nbsp; &nbsp;at Route.dispatch (F:\\Personal Project\\Newspaper-Backend\\node_modules\\express\\lib\\router\\route.js:112:3)\n            <br> &nbsp; &nbsp;at Layer.handle [as handle_request] (F:\\Personal Project\\Newspaper-Backend\\node_modules\\express\\lib\\router\\layer.js:95:5)\n            <br> &nbsp; &nbsp;at F:\\Personal Project\\Newspaper-Backend\\node_modules\\express\\lib\\router\\index.js:281:22\n            <br> &nbsp; &nbsp;at Function.process_params (F:\\Personal Project\\Newspaper-Backend\\node_modules\\express\\lib\\router\\index.js:335:12)\n            <br> &nbsp; &nbsp;at next (F:\\Personal Project\\Newspaper-Backend\\node_modules\\express\\lib\\router\\index.js:275:10)\n            <br> &nbsp; &nbsp;at Function.handle (F:\\Personal Project\\Newspaper-Backend\\node_modules\\express\\lib\\router\\index.js:174:3)\n        </pre>\n    </body>\n</html>"},{"id":"92fbc130-f1d7-4578-92ce-74fc1f13e0f3","name":"409 Email Exists","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"email\": \"\",\r\n    \"password\": \"Leo0bmNfZwLjZJv\"\r\n}","options":{"raw":{"language":"json"}}},"url":"{{base_user}}/register"},"status":"Conflict","code":409,"_postman_previewlanguage":"html","header":[{"key":"X-Powered-By","value":"Express"},{"key":"Content-Security-Policy","value":"default-src 'self'"},{"key":"X-Content-Type-Options","value":"nosniff"},{"key":"Content-Type","value":"text/html; charset=utf-8"},{"key":"Content-Length","value":"343"},{"key":"Date","value":"Sun, 10 Mar 2024 21:09:06 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"<!DOCTYPE html>\n<html lang=\"en\">\n    <head>\n        <meta charset=\"utf-8\">\n        <title>Error</title>\n    </head>\n    <body>\n        <pre>Error: Email already exists\n            <br> &nbsp; &nbsp;at F:\\Personal Project\\Newspaper-Backend\\controllers\\userController.js:49:11\n            <br> &nbsp; &nbsp;at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n        </pre>\n    </body>\n</html>"},{"id":"6bf269b7-5e5e-47b5-888e-f241482fcf76","name":"411 Pass min 8 char","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"email\": \"Cali97@gmail.com\",\r\n    \"password\": \"1212\"\r\n}","options":{"raw":{"language":"json"}}},"url":"{{base_user}}/register"},"status":"Length Required","code":411,"_postman_previewlanguage":"html","header":[{"key":"X-Powered-By","value":"Express"},{"key":"Content-Security-Policy","value":"default-src 'self'"},{"key":"X-Content-Type-Options","value":"nosniff"},{"key":"Content-Type","value":"text/html; charset=utf-8"},{"key":"Content-Length","value":"361"},{"key":"Date","value":"Sun, 10 Mar 2024 21:12:38 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"<!DOCTYPE html>\n<html lang=\"en\">\n    <head>\n        <meta charset=\"utf-8\">\n        <title>Error</title>\n    </head>\n    <body>\n        <pre>Error: Password must be at least 8 characters\n            <br> &nbsp; &nbsp;at F:\\Personal Project\\Newspaper-Backend\\controllers\\userController.js:55:11\n            <br> &nbsp; &nbsp;at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n        </pre>\n    </body>\n</html>"}],"_postman_id":"0fd4322b-0ed8-4f7c-b68a-137e316134e6"},{"name":"Login","event":[{"listen":"test","script":{"id":"064bae85-bb4d-46da-b7f4-eeca76423de8","exec":[""],"type":"text/javascript"}}],"id":"015cfeb5-4427-4eae-8c6c-8750b7c23897","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"email\": \"\",\r\n    \"password\": \"\"\r\n}","options":{"raw":{"language":"json"}}},"url":"{{base_user}}/login","description":"<p>This endpoint is used to log in a user via HTTP POST request to {{base_user}}/login. The request should include a raw JSON payload with \"email\" and \"password\" fields.</p>\n<h3 id=\"request-body\">Request Body</h3>\n<ul>\n<li>email (string, required): The email of the user.</li>\n<li>password (string, required): The password of the user.</li>\n</ul>\n<h3 id=\"response\">Response</h3>\n<ul>\n<li>statusCode (number): The status code of the response.</li>\n<li>data (object): An object containing user information such as _id, email, articles, fevCategory, createdAt, updatedAt, __v, and refreshToken.</li>\n<li>message (string): A message related to the response.</li>\n<li>success (boolean): Indicates if the request was successful.</li>\n</ul>\n<p>The examples of responses for this request include a statusCode, data object, message, and success boolean. The data object contains user information such as _id, email, articles, fevCategory, createdAt, updatedAt, __v, and refreshToken.</p>\n","urlObject":{"path":["login"],"host":["{{base_user}}"],"query":[],"variable":[]}},"response":[{"id":"af1ec702-4ce3-4816-b971-6eb7be177d16","name":"200 Success","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"email\": \"\",\r\n    \"password\": \"\"\r\n}","options":{"raw":{"language":"json"}}},"url":"{{base_user}}/login"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"X-Powered-By","value":"Express"},{"key":"Set-Cookie","value":"refreshToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY1ZWUyMmM3NDIzMGNlNzJmNmRiMmM5MyIsImlhdCI6MTcxMDEwNTI5MSwiZXhwIjoxNzE4NzQ1MjkxfQ.7UzNBlxcTjSvWX1AhQr1nFrqrpJPwvk8t2BBDLVYm00; Path=/; HttpOnly; Secure"},{"key":"Set-Cookie","value":"accessToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY1ZWUyMmM3NDIzMGNlNzJmNmRiMmM5MyIsImVtYWlsIjoiYWxsYW5fdHJvbXA4OUB5YWhvby5jb20iLCJpYXQiOjE3MTAxMDUyOTEsImV4cCI6MTcxMDEwNTI5MX0.aV6X76ZTYPzcveVZFVelQPrXZeOD4dQ-fFGhjG4Rkcw; Path=/; HttpOnly; Secure"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"455"},{"key":"ETag","value":"W/\"1c7-Ti95qLzXLn6YHLc67wXfg/9OQX4\""},{"key":"Date","value":"Sun, 10 Mar 2024 21:14:51 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"{\n    \"statusCode\": 200,\n    \"data\": {\n        \"_id\": \"65ee22c74230ce72f6db2c93\",\n        \"email\": \"allan_tromp89@yahoo.com\",\n        \"articles\": [],\n        \"fevCategory\": [],\n        \"createdAt\": \"2024-03-10T21:14:47.639Z\",\n        \"updatedAt\": \"2024-03-10T21:14:51.754Z\",\n        \"__v\": 0,\n        \"refreshToken\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY1ZWUyMmM3NDIzMGNlNzJmNmRiMmM5MyIsImlhdCI6MTcxMDEwNTI5MSwiZXhwIjoxNzE4NzQ1MjkxfQ.7UzNBlxcTjSvWX1AhQr1nFrqrpJPwvk8t2BBDLVYm00\"\n    },\n    \"message\": \"User logged in successfully\",\n    \"success\": true\n}"},{"id":"bfc5d2a5-84a8-4cce-bde9-ce4fd5b6925d","name":"404 User Not Found","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"email\": \"{{emails}}\",\r\n    \"password\": \"\"\r\n}","options":{"raw":{"language":"json"}}},"url":"{{base_user}}/login"},"status":"Not Found","code":404,"_postman_previewlanguage":"html","header":[{"key":"X-Powered-By","value":"Express"},{"key":"Content-Security-Policy","value":"default-src 'self'"},{"key":"X-Content-Type-Options","value":"nosniff"},{"key":"Content-Type","value":"text/html; charset=utf-8"},{"key":"Content-Length","value":"338"},{"key":"Date","value":"Sun, 10 Mar 2024 21:17:02 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"<!DOCTYPE html>\n<html lang=\"en\">\n    <head>\n        <meta charset=\"utf-8\">\n        <title>Error</title>\n    </head>\n    <body>\n        <pre>Error: User not found\n            <br> &nbsp; &nbsp;at F:\\Personal Project\\Newspaper-Backend\\controllers\\userController.js:100:11\n            <br> &nbsp; &nbsp;at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n        </pre>\n    </body>\n</html>"},{"id":"ceb9d7cb-900c-48cd-98d6-09da1f90ff66","name":"401 Invalid credentials","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"email\": \"\",\r\n    \"password\": \"{{passwords}}\"\r\n}","options":{"raw":{"language":"json"}}},"url":"{{base_user}}/login"},"status":"Unauthorized","code":401,"_postman_previewlanguage":"html","header":[{"key":"X-Powered-By","value":"Express"},{"key":"Content-Security-Policy","value":"default-src 'self'"},{"key":"X-Content-Type-Options","value":"nosniff"},{"key":"Content-Type","value":"text/html; charset=utf-8"},{"key":"Content-Length","value":"248"},{"key":"Date","value":"Sun, 10 Mar 2024 21:17:26 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"<!DOCTYPE html>\n<html lang=\"en\">\n    <head>\n        <meta charset=\"utf-8\">\n        <title>Error</title>\n    </head>\n    <body>\n        <pre>Error: Invalid credentials\n            <br> &nbsp; &nbsp;at F:\\Personal Project\\Newspaper-Backend\\controllers\\userController.js:107:11\n        </pre>\n    </body>\n</html>"}],"_postman_id":"015cfeb5-4427-4eae-8c6c-8750b7c23897"},{"name":"Logout","id":"5e199e87-a020-453a-8889-c70b7ea4bb30","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"{{base_user}}/logout","description":"<p>This endpoint is used to log out the user. Upon successful logout, the API returns a JSON response with a \"success\" key indicating the operation was successful, and an optional \"message\" key with additional information.</p>\n<h3 id=\"response\">Response</h3>\n<ul>\n<li><code>success</code>: Indicates if the logout operation was successful.</li>\n<li><code>message</code>: An optional message providing additional information.</li>\n</ul>\n<h4 id=\"example\">Example</h4>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n    \"success\": true,\n    \"message\": \"\"\n}\n\n</code></pre>\n","urlObject":{"path":["logout"],"host":["{{base_user}}"],"query":[],"variable":[]}},"response":[{"id":"149b4a89-855a-4fbd-90e3-e7858235c24f","name":"200 Success","originalRequest":{"method":"GET","header":[],"url":"{{base_user}}/logout"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"X-Powered-By","value":"Express"},{"key":"Set-Cookie","value":"refreshToken=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT; HttpOnly; Secure"},{"key":"Set-Cookie","value":"accessToken=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT; HttpOnly; Secure"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"57"},{"key":"ETag","value":"W/\"39-O7AOr9967nXGEOigmT1kSGSsje4\""},{"key":"Date","value":"Sun, 10 Mar 2024 21:31:13 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"{\n    \"success\": true,\n    \"message\": \"User Logged Out Successfully\"\n}"},{"id":"52788a26-562c-4edf-a48f-c80b86bfa53b","name":"401 Unauthorized","originalRequest":{"method":"GET","header":[],"url":"{{base_user}}/logout"},"status":"Unauthorized","code":401,"_postman_previewlanguage":"json","header":[{"key":"X-Powered-By","value":"Express"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"25"},{"key":"ETag","value":"W/\"19-1luTU257I9tvKUXOJotGBQDVDqk\""},{"key":"Date","value":"Sun, 10 Mar 2024 21:20:40 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"{\n    \"error\": \"Invalid token\"\n}"}],"_postman_id":"5e199e87-a020-453a-8889-c70b7ea4bb30"},{"name":"LoggedinUser","id":"5b6c1a08-1665-48eb-8b9a-6539e7eea593","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"{{base_user}}/loggedin-user","description":"<p>This endpoint retrieves the details of the currently logged-in user. The response will include the user's unique ID, email, a list of articles associated with the user, favorite categories, creation and update timestamps, and a refresh token for authentication.</p>\n","urlObject":{"path":["loggedin-user"],"host":["{{base_user}}"],"query":[],"variable":[]}},"response":[{"id":"862becb6-e5bd-4431-9f2b-98d9f478e9a1","name":"200 Success","originalRequest":{"method":"GET","header":[],"url":"{{base_user}}/loggedin-user"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"X-Powered-By","value":"Express"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"374"},{"key":"ETag","value":"W/\"176-oqOyCBsPS9gaEwlzP8AzSVOHhsI\""},{"key":"Date","value":"Sun, 10 Mar 2024 21:34:22 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"{\n    \"_id\": \"65ee22c74230ce72f6db2c93\",\n    \"email\": \"allan_tromp89@yahoo.com\",\n    \"articles\": [],\n    \"fevCategory\": [],\n    \"createdAt\": \"2024-03-10T21:14:47.639Z\",\n    \"updatedAt\": \"2024-03-10T21:34:20.627Z\",\n    \"__v\": 0,\n    \"refreshToken\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY1ZWUyMmM3NDIzMGNlNzJmNmRiMmM5MyIsImlhdCI6MTcxMDEwNjQ2MCwiZXhwIjoxNzE4NzQ2NDYwfQ.DhXkYJsAUa8Wh8c0yv7vwpiOLmoepLsjQKCm_rSNwh0\"\n}"},{"id":"a7b24e3c-ab88-41e7-847c-dae192d768e4","name":"401 Unauthorized","originalRequest":{"method":"GET","header":[],"url":"{{base_user}}/loggedin-user"},"status":"Unauthorized","code":401,"_postman_previewlanguage":"json","header":[{"key":"X-Powered-By","value":"Express"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"31"},{"key":"ETag","value":"W/\"1f-crg7ovEEHb9AqDObckZob3ngQr8\""},{"key":"Date","value":"Sun, 10 Mar 2024 21:33:22 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"{\n    \"error\": \"Please authenticate\"\n}"}],"_postman_id":"5b6c1a08-1665-48eb-8b9a-6539e7eea593"},{"name":"Delete-User","id":"0b451423-02a7-45ed-9b9c-c1742ceb3f54","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[],"url":"{{base_user}}/delete-user","description":"<h3 id=\"delete-user\">Delete User</h3>\n<p>This endpoint is used to delete a user.</p>\n<p><strong>HTTP Request</strong></p>\n<ul>\n<li>Method: DELETE</li>\n<li>Endpoint: {{base_user}}/delete-user</li>\n</ul>\n<p><strong>Response</strong></p>\n<ul>\n<li>success (boolean): Indicates whether the operation was successful.</li>\n<li>message (string, optional): A message providing additional information about the operation.</li>\n</ul>\n","urlObject":{"path":["delete-user"],"host":["{{base_user}}"],"query":[],"variable":[]}},"response":[{"id":"a7f81e1a-6517-4489-8f6e-d65ca0e4f4ff","name":"200 Success","originalRequest":{"method":"DELETE","header":[],"url":"{{base_user}}/delete-user"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"X-Powered-By","value":"Express"},{"key":"Set-Cookie","value":"refreshToken=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT; HttpOnly; Secure"},{"key":"Set-Cookie","value":"accessToken=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT; HttpOnly; Secure"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"54"},{"key":"ETag","value":"W/\"36-e0L0zyxZBRE2Kq7qlGvOV7s23QI\""},{"key":"Date","value":"Sun, 10 Mar 2024 21:36:46 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"{\n    \"success\": true,\n    \"message\": \"User Deleted Successfully\"\n}"},{"id":"9496f847-f512-49c7-bf3f-e03e761b85ea","name":"401 Unautiorized","originalRequest":{"method":"DELETE","header":[],"url":"{{base_user}}/delete-user"},"status":"Unauthorized","code":401,"_postman_previewlanguage":"json","header":[{"key":"X-Powered-By","value":"Express"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"31"},{"key":"ETag","value":"W/\"1f-crg7ovEEHb9AqDObckZob3ngQr8\""},{"key":"Date","value":"Sun, 10 Mar 2024 21:37:29 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"{\n    \"error\": \"Please authenticate\"\n}"}],"_postman_id":"0b451423-02a7-45ed-9b9c-c1742ceb3f54"},{"name":"Update-User","id":"8dba5902-9c41-44f0-9e0c-ad652daffff6","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\r\n\r\n    \"name\": \"Casey Boehm\",\r\n    \"bio\": \"Natus qui minima. Maiores omnis quis saepe et iusto. Eum doloremque sunt non ut aut quia numquam. Sequi assumenda quo alias sequi qui et et nihil. Porro qui magni.\",\r\n    \"DOB\": \"0000-00-00\" //DOB format should be \"YYYY-MM-DD\"\r\n}","options":{"raw":{"language":"json"}}},"url":"{{base_user}}/update-user","description":"<p>This endpoint allows updating user information via an HTTP PUT request. The request should include a JSON payload with the user's name, bio, and date of birth (DOB) in the format \"YYYY-MM-DD\".</p>\n<h3 id=\"request-body\">Request Body</h3>\n<ul>\n<li><code>name</code> (string): The updated name of the user.</li>\n<li><code>bio</code> (string): The updated biography of the user.</li>\n<li><code>DOB</code> (string): The updated date of birth of the user in the format \"YYYY-MM-DD\".</li>\n</ul>\n<h3 id=\"response\">Response</h3>\n<ul>\n<li><code>success</code> (boolean): Indicates if the update was successful.</li>\n<li><code>message</code> (string): A message providing additional information about the update.</li>\n</ul>\n<p>Example:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n    \"success\": true,\n    \"message\": \"\"\n}\n\n</code></pre>\n","urlObject":{"path":["update-user"],"host":["{{base_user}}"],"query":[],"variable":[]}},"response":[{"id":"b4050986-5087-4654-af73-179641ca910b","name":"200 Success","originalRequest":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\r\n\r\n    \"name\": \"Mr. Hilda Baumbach\",\r\n    \"bio\": \"Provident aut voluptatem impedit placeat necessitatibus in sed quaerat et. Saepe unde quia sit. Sed mollitia consequatur doloribus maxime architecto voluptates asperiores doloribus.\",\r\n    \"DOB\": \"0000-00-00\" //DOB format should be \"YYYY-MM-DD\"\r\n}","options":{"raw":{"language":"json"}}},"url":"{{base_user}}/update-user"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"X-Powered-By","value":"Express"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"54"},{"key":"ETag","value":"W/\"36-AmUN6m0VmxopoOPOlGWFmU6VQTA\""},{"key":"Date","value":"Sun, 10 Mar 2024 21:46:22 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"{\n    \"success\": true,\n    \"message\": \"User Updated Successfully\"\n}"},{"id":"d016e855-ab2b-4e8e-abb1-2f28cf365f63","name":"400 No param","originalRequest":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\r\n\r\n   \r\n}","options":{"raw":{"language":"json"}}},"url":"{{base_user}}/update-user"},"status":"Bad Request","code":400,"_postman_previewlanguage":"html","header":[{"key":"X-Powered-By","value":"Express"},{"key":"Content-Security-Policy","value":"default-src 'self'"},{"key":"X-Content-Type-Options","value":"nosniff"},{"key":"Content-Type","value":"text/html; charset=utf-8"},{"key":"Content-Length","value":"801"},{"key":"Date","value":"Sun, 10 Mar 2024 21:47:07 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"<!DOCTYPE html>\n<html lang=\"en\">\n    <head>\n        <meta charset=\"utf-8\">\n        <title>Error</title>\n    </head>\n    <body>\n        <pre>Error: Minimum one paramiter required\n            <br> &nbsp; &nbsp;at F:\\Personal Project\\Newspaper-Backend\\controllers\\userController.js:184:11\n            <br> &nbsp; &nbsp;at F:\\Personal Project\\Newspaper-Backend\\utils\\asyncHandler.js:3:21\n            <br> &nbsp; &nbsp;at Layer.handle [as handle_request] (F:\\Personal Project\\Newspaper-Backend\\node_modules\\express\\lib\\router\\layer.js:95:5)\n            <br> &nbsp; &nbsp;at next (F:\\Personal Project\\Newspaper-Backend\\node_modules\\express\\lib\\router\\route.js:137:13)\n            <br> &nbsp; &nbsp;at isUserLoggedin (F:\\Personal Project\\Newspaper-Backend\\middlewares\\isUserLoggedin.js:33:5)\n            <br> &nbsp; &nbsp;at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n        </pre>\n    </body>\n</html>"}],"_postman_id":"8dba5902-9c41-44f0-9e0c-ad652daffff6"},{"name":"Token-renew","id":"bea672ef-3fc8-461d-9d0e-73a10ac4893d","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"{{base_user}}/token-renew","description":"<p>This endpoint sends an HTTP GET request to renew the token at the specified base user URL. The response will include a boolean value indicating the success status, and an optional message string.</p>\n<p>Example response:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n    \"success\": true,\n    \"message\": \"\"\n}\n\n</code></pre>\n","urlObject":{"path":["token-renew"],"host":["{{base_user}}"],"query":[],"variable":[]}},"response":[{"id":"10677cac-1124-4671-83b1-15e6c03c1eee","name":"200 Success","originalRequest":{"method":"GET","header":[],"url":"{{base_user}}/token-renew"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"X-Powered-By","value":"Express"},{"key":"Set-Cookie","value":"refreshToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY1ZWUyODZhZDZjMGVlYzkwNDg3ZWY4OSIsImlhdCI6MTcxMDEwNzM4MCwiZXhwIjoxNzE4NzQ3MzgwfQ.nijWx8zE_k4CmuLvbcibPh3Zs2z7LSW2aAHaXLyMJY8; Path=/; HttpOnly; Secure"},{"key":"Set-Cookie","value":"accessToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY1ZWUyODZhZDZjMGVlYzkwNDg3ZWY4OSIsImVtYWlsIjoicnVieWVfenVsYXVmQGhvdG1haWwuY29tIiwiaWF0IjoxNzEwMTA3MzgwLCJleHAiOjE3MTAxOTM3ODB9.EG6cGvyM4qbqpTzGY1SixqqKDAWZ0c45IDE47cCVD1A; Path=/; HttpOnly; Secure"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"55"},{"key":"ETag","value":"W/\"37-KmTAcKgabgMDPWDW1RegcQcSWQY\""},{"key":"Date","value":"Sun, 10 Mar 2024 21:49:40 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"{\n    \"success\": true,\n    \"message\": \"Token Renewed Successfully\"\n}"},{"id":"9ca1209d-95e1-4050-8f6b-60b793b2629c","name":"403 Missing Token","originalRequest":{"method":"GET","header":[],"url":"{{base_user}}/token-renew"},"status":"Forbidden","code":403,"_postman_previewlanguage":"html","header":[{"key":"X-Powered-By","value":"Express"},{"key":"Content-Security-Policy","value":"default-src 'self'"},{"key":"X-Content-Type-Options","value":"nosniff"},{"key":"Content-Type","value":"text/html; charset=utf-8"},{"key":"Content-Length","value":"1317"},{"key":"Date","value":"Sun, 10 Mar 2024 21:50:51 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"<!DOCTYPE html>\n<html lang=\"en\">\n    <head>\n        <meta charset=\"utf-8\">\n        <title>Error</title>\n    </head>\n    <body>\n        <pre>Error: Token is missing\n            <br> &nbsp; &nbsp;at F:\\Personal Project\\Newspaper-Backend\\controllers\\userController.js:208:11\n            <br> &nbsp; &nbsp;at F:\\Personal Project\\Newspaper-Backend\\utils\\asyncHandler.js:3:21\n            <br> &nbsp; &nbsp;at Layer.handle [as handle_request] (F:\\Personal Project\\Newspaper-Backend\\node_modules\\express\\lib\\router\\layer.js:95:5)\n            <br> &nbsp; &nbsp;at next (F:\\Personal Project\\Newspaper-Backend\\node_modules\\express\\lib\\router\\route.js:137:13)\n            <br> &nbsp; &nbsp;at Route.dispatch (F:\\Personal Project\\Newspaper-Backend\\node_modules\\express\\lib\\router\\route.js:112:3)\n            <br> &nbsp; &nbsp;at Layer.handle [as handle_request] (F:\\Personal Project\\Newspaper-Backend\\node_modules\\express\\lib\\router\\layer.js:95:5)\n            <br> &nbsp; &nbsp;at F:\\Personal Project\\Newspaper-Backend\\node_modules\\express\\lib\\router\\index.js:281:22\n            <br> &nbsp; &nbsp;at Function.process_params (F:\\Personal Project\\Newspaper-Backend\\node_modules\\express\\lib\\router\\index.js:335:12)\n            <br> &nbsp; &nbsp;at next (F:\\Personal Project\\Newspaper-Backend\\node_modules\\express\\lib\\router\\index.js:275:10)\n            <br> &nbsp; &nbsp;at Function.handle (F:\\Personal Project\\Newspaper-Backend\\node_modules\\express\\lib\\router\\index.js:174:3)\n        </pre>\n    </body>\n</html>"},{"id":"8be7e45b-e102-42dd-a06f-fcb91fe4cb25","name":"401 Invalid Token","originalRequest":{"method":"GET","header":[],"url":"{{base_user}}/token-renew"},"status":"Unauthorized","code":401,"_postman_previewlanguage":"html","header":[{"key":"X-Powered-By","value":"Express"},{"key":"Content-Security-Policy","value":"default-src 'self'"},{"key":"X-Content-Type-Options","value":"nosniff"},{"key":"Content-Type","value":"text/html; charset=utf-8"},{"key":"Content-Length","value":"337"},{"key":"Date","value":"Sun, 10 Mar 2024 21:53:23 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"<!DOCTYPE html>\n<html lang=\"en\">\n    <head>\n        <meta charset=\"utf-8\">\n        <title>Error</title>\n    </head>\n    <body>\n        <pre>Error: Invalid Token\n            <br> &nbsp; &nbsp;at F:\\Personal Project\\Newspaper-Backend\\controllers\\userController.js:228:11\n            <br> &nbsp; &nbsp;at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n        </pre>\n    </body>\n</html>"}],"_postman_id":"bea672ef-3fc8-461d-9d0e-73a10ac4893d"}],"event":[{"listen":"prerequest","script":{"id":"9dc3a048-6071-47af-ba14-999b8c58f7da","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"b8fdcabe-3b6e-4913-8558-fd9cfd19b1f6","type":"text/javascript","exec":[""]}}],"variable":[{"key":"email","value":""},{"key":"password","value":""}]}