{"info":{"_postman_id":"d158c79c-e286-4a72-a3d2-1631b5f46189","name":"Roomie-Backend-API-Documentation","description":"<html><head></head><body><p>Roomie is a web application allowing people in the same apartment to manage weekly housework.</p>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"owner":"4337348","collectionId":"d158c79c-e286-4a72-a3d2-1631b5f46189","publishedId":"UUxwCov3","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"publishDate":"2021-09-23T10:31:36.000Z"},"item":[{"name":"POST /api/accounts","id":"a996cf1f-c6da-49e1-97aa-055e6b781b5f","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"name\": \"Anh Tu Mai\",\n    \"username\": \"anhtumai\",\n    \"password\": \"anhtumaipassword\"\n}","options":{"raw":{"language":"json"}}},"url":"/api/accounts","description":"<p>Register a new user</p>\n","urlObject":{"path":["api","accounts"],"host":[""],"query":[],"variable":[]}},"response":[{"id":"d0f25548-c604-458a-94b2-2760bf0c9fc9","name":"Register Valid User","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"name\": \"Anh Tu Mai\",\n    \"username\": \"anhtumai\",\n    \"password\": \"anhtumaipassword\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/accounts"},"status":"Created","code":201,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"id\": 766,\n    \"username\": \"anhtumai\",\n    \"name\": \"Anh Tu Mai\"\n}"},{"id":"d46190ae-ea5e-46f9-9f70-fd8464904f4c","name":"Register with missing information","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"name\": \"Anh Tu Mai\",\n    \"password\": \"anhtumaipassword\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/accounts"},"status":"Bad Request","code":400,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"error\": \"Invalid body\"\n}"},{"id":"c3a926db-2c6d-4111-8c4f-3a30012ab737","name":"Register with dupplicated property","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"name\": \"Anh Tu Mai\",\n    \"username\": \"anhtumai\",\n    \"password\": \"anhtumaipassword\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/accounts"},"status":"Bad Request","code":400,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"error\": \"ConditionNotMeet error: User with the same username has already existed\"\n}"}],"_postman_id":"a996cf1f-c6da-49e1-97aa-055e6b781b5f"},{"name":"PUT /api/accounts/:id","id":"5a39d48e-7ee1-417e-a4f7-538b51f2c4d9","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"<token>"}]},"isInherited":false},"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\n    \"username\": \"new_username\",\n    \"name\": \"New Name\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/accounts/767","description":"<p>Update account profile</p>\n","urlObject":{"path":["api","accounts","767"],"host":["http://localhost:3003"],"query":[],"variable":[]}},"response":[],"_postman_id":"5a39d48e-7ee1-417e-a4f7-538b51f2c4d9"},{"name":"POST /api/auth/login","id":"ef175d6e-825e-473b-bbd5-70ccf8be2ea9","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"username\": \"anhtumai\",\n    \"password\": \"anhtumaipasswords\"\n}","options":{"raw":{"language":"json"}}},"url":"/api/auth/login","description":"<p>Login with username or password.</p>\n","urlObject":{"path":["api","auth","login"],"host":[""],"query":[],"variable":[]}},"response":[{"id":"a4f7030f-07ad-4ca9-92e5-7788a595d0c0","name":"Login with wrong credentials","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"username\": \"anhtumai\",\n    \"password\": \"wrongpassword\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/auth/login"},"status":"Unauthorized","code":401,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"error\": \"Auth error: invalid username or password\"\n}"},{"id":"61f27832-024b-4fa3-811a-4fb99f300439","name":"Login with valid credentials","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"username\": \"anhtumai\",\n    \"password\": \"anhtumaipassword\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/auth/login"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFuaHR1bWFpIiwiaWQiOjc2NiwiaWF0IjoxNjM2NzU0OTQ5LCJleHAiOjE2MzY3NjU3NDl9.y-Okp7sfhzMue1Jf9067IKdaI7sqUZJnoEFFualV7As\",\n    \"username\": \"anhtumai\",\n    \"name\": \"Anh Tu Mai\",\n    \"id\": 766,\n    \"expiresAt\": 1636765749\n}"}],"_postman_id":"ef175d6e-825e-473b-bbd5-70ccf8be2ea9"},{"name":"POST /api/apartments","id":"92191c57-40e3-4a4b-8329-3866b25f828a","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":false},"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"name\": \"HOAS Apartment\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/apartments","description":"<p>Create new apartment.</p>\n<p>Requirement:</p>\n<ul>\n<li>Token authentication</li>\n<li>User must not be a member of any apartments</li>\n</ul>\n<p>After creation, user will be admin of new apartment</p>\n","urlObject":{"path":["api","apartments"],"host":["http://localhost:3003"],"query":[],"variable":[]}},"response":[{"id":"613a221a-1f8b-4507-9c80-02679bdb70ad","name":"Create new apartment","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"name\": \"HOAS Apartment\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/apartments"},"status":"Created","code":201,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"id\": 185,\n    \"name\": \"HOAS Apartment\",\n    \"admin_id\": 766\n}"},{"id":"25ef7f02-e841-4bfa-9591-6919a26e7375","name":"Create another apartment","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"name\": \"HOAS Apartment\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/apartments"},"status":"Bad Request","code":400,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"error\": \"ConditionNotMeet error: User can only live in 1 apartment\"\n}"}],"_postman_id":"92191c57-40e3-4a4b-8329-3866b25f828a"},{"name":"PUT /api/apartments/:id","id":"bb768aa7-7bdd-4333-84fa-2bfd119aa503","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":false},"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\n    \"name\": \"Happy apartment\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/apartments/186","description":"<p>Change name of current apartment</p>\n<p>Requires:</p>\n<ul>\n<li>Token authentication</li>\n<li>Only admin can change name of apartment</li>\n</ul>\n","urlObject":{"path":["api","apartments","186"],"host":["http://localhost:3003"],"query":[],"variable":[]}},"response":[{"id":"d6cace52-2530-4eb9-80f5-e511fc8a3369","name":"Edit the apartment as an admin","originalRequest":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\n    \"name\": \"Happy apartment\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/apartments/185"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"X-Powered-By","value":"Express"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"50"},{"key":"ETag","value":"W/\"32-6wLbdFFmz+pkpIcMMz3x6Losouw\""},{"key":"Date","value":"Fri, 12 Nov 2021 22:12:54 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"{\n    \"id\": 185,\n    \"name\": \"Happy apartment\",\n    \"admin_id\": 766\n}"},{"id":"3d9949d8-46f6-4cff-8f4d-a5dbca91d89b","name":"Edit the apartment as not an admin","originalRequest":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\n    \"name\": \"Happy apartment\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/apartments/185"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"X-Powered-By","value":"Express"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"50"},{"key":"ETag","value":"W/\"32-6wLbdFFmz+pkpIcMMz3x6Losouw\""},{"key":"Date","value":"Fri, 12 Nov 2021 22:12:54 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"{\n    \"error\": \"Forbidden error\"\n}"}],"_postman_id":"bb768aa7-7bdd-4333-84fa-2bfd119aa503"},{"name":"DELETE /api/apartments/:id","id":"24bb94f4-7734-40d6-a21a-9497518c94bc","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":false},"method":"DELETE","header":[],"url":"http://localhost:3003/api/apartments/145","description":"<p>Delete your current apartment</p>\n<p>Requires:</p>\n<ul>\n<li>Token authentication</li>\n<li>Only admin can delete</li>\n</ul>\n","urlObject":{"path":["api","apartments","145"],"host":["http://localhost:3003"],"query":[],"variable":[]}},"response":[{"id":"b8d0b027-2412-4fe1-b7d9-e8038d21ac97","name":"Delete Apartment","originalRequest":{"method":"DELETE","header":[],"url":"http://localhost:3003/api/apartments/136"},"status":"No Content","code":204,"_postman_previewlanguage":null,"header":null,"cookie":[],"responseTime":null,"body":null},{"id":"96745441-9b9d-4391-942f-d83564891dd8","name":"Delete Apartment when you are not admin","originalRequest":{"method":"DELETE","header":[],"url":"http://localhost:3003/api/apartments/136"},"status":"Forbidden","code":403,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"error\": \"Forbidden error\"\n}"}],"_postman_id":"24bb94f4-7734-40d6-a21a-9497518c94bc"},{"name":"DELETE /api/me/apartment","id":"b69bc635-167e-460e-b30d-bc9359b4cb46","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImZpcnN0dGVzdHVzZXIiLCJpZCI6NTk4LCJpYXQiOjE2MzIzNzcwNDUsImV4cCI6MTYzMjM4Nzg0NX0.8UvSio3m4GxgYxGXdwSnrI0oaheCxiJ5rcQ5zzPARIA"}]},"isInherited":false},"method":"DELETE","header":[],"url":"http://localhost:3003/api/me/apartment","description":"<p>Leave your own apartment</p>\n<p>Requires:</p>\n<ul>\n<li>Token authentication</li>\n</ul>\n","urlObject":{"path":["api","me","apartment"],"host":["http://localhost:3003"],"query":[],"variable":[]}},"response":[{"id":"a6ca5e01-b853-4e79-88aa-c54767496a47","name":"Leave Apartment","originalRequest":{"method":"DELETE","header":[],"url":"http://localhost:3003/api/me/apartment"},"status":"No Content","code":204,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"msg\": \"Leave the aparment Happy apartment\"\n}"},{"id":"43014726-990b-4c81-9ffe-8464dd9a5f76","name":"Leave apartment when you dont have an apartment","originalRequest":{"method":"DELETE","header":[],"url":"http://localhost:3003/api/me/apartment"},"status":"No Content","code":204,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":""}],"_postman_id":"b69bc635-167e-460e-b30d-bc9359b4cb46"},{"name":"DELETE /api/me/apartment/members/:id","id":"d32d421f-d8bf-44a9-92c7-8e134db59c0e","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"<token>"}]},"isInherited":false},"method":"DELETE","header":[],"url":"http://localhost:3003/api/me/apartment/members/766","description":"<p>Leave your own apartment</p>\n<p>Requires:</p>\n<ul>\n<li>Token authentication</li>\n</ul>\n","urlObject":{"path":["api","me","apartment","members","766"],"host":["http://localhost:3003"],"query":[],"variable":[]}},"response":[],"_postman_id":"d32d421f-d8bf-44a9-92c7-8e134db59c0e"},{"name":"GET /api/me","id":"d607e8fd-d611-42e4-8039-ea9dc5f3e7db","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":false},"method":"GET","header":[],"url":"http://localhost:3003/api/me","description":"<p>Get profile information, such as name, username and apartment ID (if possible)</p>\n<p>Requires:</p>\n<ul>\n<li>Token authentication</li>\n</ul>\n","urlObject":{"path":["api","me"],"host":["http://localhost:3003"],"query":[],"variable":[]}},"response":[{"id":"3c287de0-5de9-4fcb-b3a1-20e7903abbc5","name":"Get Personal Information if you have apartment","originalRequest":{"method":"GET","header":[],"url":"http://localhost:3003/api/me"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"id\": 595,\n    \"username\": \"anhtumai\",\n    \"name\": \"Anh Tu Mai\",\n    \"apartment\": {\n        \"id\": 136,\n        \"name\": \"HOAS Apartment\"\n    }\n}"},{"id":"a791c39c-2f34-43bd-a08d-9cebcc5569e5","name":"Get Personal Information if you dont have apartment","originalRequest":{"method":"GET","header":[],"url":"http://localhost:3003/api/me"},"code":200,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"id\": 598,\n    \"username\": \"firsttestuser\",\n    \"name\": \"First Test User\",\n    \"apartment\": null\n}"}],"_postman_id":"d607e8fd-d611-42e4-8039-ea9dc5f3e7db"},{"name":"GET /api/me/apartment","id":"69caade5-2b13-4d5f-8207-f41c424036be","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":false},"method":"GET","header":[],"url":"http://localhost:3003/api/me/apartment","description":"<p>Get all information about your apartment, including members, tasks, ...</p>\n<p>Requires:</p>\n<ul>\n<li>Token authentication</li>\n</ul>\n","urlObject":{"path":["api","me","apartment"],"host":["http://localhost:3003"],"query":[],"variable":[]}},"response":[{"id":"fc142203-0173-452e-a102-03ce612c3ef4","name":"Get Apartment","originalRequest":{"method":"GET","header":[],"url":"http://localhost:3003/api/me/apartment"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"id\": 136,\n    \"name\": \"HOAS Apartment\",\n    \"admin\": {\n        \"id\": 595,\n        \"username\": \"anhtumai\",\n        \"name\": \"Anh Tu Mai\"\n    },\n    \"members\": [\n        {\n            \"id\": 599,\n            \"username\": \"secondtestuser\",\n            \"name\": \"Second Test User\"\n        },\n        {\n            \"id\": 595,\n            \"username\": \"anhtumai\",\n            \"name\": \"Anh Tu Mai\"\n        },\n        {\n            \"id\": 598,\n            \"username\": \"firsttestuser\",\n            \"name\": \"First Test User\"\n        }\n    ],\n    \"task_requests\": [\n        {\n            \"task\": {\n                \"id\": 72,\n                \"name\": \"Clean the kitchen\",\n                \"description\": \"clean the sink, ...\",\n                \"frequency\": 2,\n                \"difficulty\": 6,\n                \"start\": \"2021-08-31T21:00:00.000Z\",\n                \"end\": \"2022-08-31T21:00:00.000Z\",\n                \"creator_id\": 595\n            },\n            \"requests\": [\n                {\n                    \"id\": 204,\n                    \"state\": \"pending\",\n                    \"assigner\": {\n                        \"id\": 595,\n                        \"name\": \"Anh Tu Mai\",\n                        \"username\": \"anhtumai\"\n                    }\n                },\n                {\n                    \"id\": 205,\n                    \"state\": \"pending\",\n                    \"assigner\": {\n                        \"id\": 598,\n                        \"name\": \"First Test User\",\n                        \"username\": \"firsttestuser\"\n                    }\n                },\n                {\n                    \"id\": 206,\n                    \"state\": \"pending\",\n                    \"assigner\": {\n                        \"id\": 599,\n                        \"name\": \"Second Test User\",\n                        \"username\": \"secondtestuser\"\n                    }\n                }\n            ]\n        }\n    ],\n    \"task_assignments\": [\n        {\n            \"task\": {\n                \"id\": 71,\n                \"name\": \"Clean the bathroom\",\n                \"description\": \"clean the toilet, clean what the fuck, ......\",\n                \"frequency\": 2,\n                \"difficulty\": 10,\n                \"start\": \"2021-08-31T21:00:00.000Z\",\n                \"end\": \"2022-08-31T21:00:00.000Z\",\n                \"creator_id\": 595\n            },\n            \"assignments\": [\n                {\n                    \"id\": 136,\n                    \"order\": 0,\n                    \"assigner\": {\n                        \"id\": 595,\n                        \"name\": \"Anh Tu Mai\",\n                        \"username\": \"anhtumai\"\n                    }\n                },\n                {\n                    \"id\": 137,\n                    \"order\": 1,\n                    \"assigner\": {\n                        \"id\": 598,\n                        \"name\": \"First Test User\",\n                        \"username\": \"firsttestuser\"\n                    }\n                },\n                {\n                    \"id\": 138,\n                    \"order\": 2,\n                    \"assigner\": {\n                        \"id\": 599,\n                        \"name\": \"Second Test User\",\n                        \"username\": \"secondtestuser\"\n                    }\n                }\n            ]\n        }\n    ]\n}"},{"id":"b74a0f42-4160-4e97-9844-343d295fe418","name":"Get Apartment when you dont have apartment","originalRequest":{"method":"GET","header":[],"url":"http://localhost:3003/api/me/apartment"},"status":"No Content","code":204,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":""}],"_postman_id":"69caade5-2b13-4d5f-8207-f41c424036be"},{"name":"GET /api/me/invitations","id":"f8115d24-1f08-4499-b5c8-bc7dbbd1bc9d","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":false},"method":"GET","header":[],"url":"http://localhost:3003/api/me/invitations","description":"<p>Get all invitations</p>\n<p>Requires:</p>\n<ul>\n<li>Token authentication</li>\n</ul>\n","urlObject":{"path":["api","me","invitations"],"host":["http://localhost:3003"],"query":[],"variable":[]}},"response":[{"id":"3fce40ba-72ff-4f30-9572-10fd0001695a","name":"For sender","originalRequest":{"method":"GET","header":[],"url":"http://localhost:3003/api/me/invitations"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"sent\": [\n        {\n            \"id\": 323,\n            \"invitor\": {\n                \"id\": 595,\n                \"username\": \"anhtumai\",\n                \"name\": \"Anh Tu Mai\"\n            },\n            \"invitee\": {\n                \"id\": 599,\n                \"username\": \"secondtestuser\",\n                \"name\": \"Second Test User\"\n            },\n            \"apartment\": {\n                \"id\": 136,\n                \"name\": \"HOAS Apartment\"\n            }\n        }\n    ],\n    \"received\": []\n}"},{"id":"e9dd25ec-4978-4ef9-b14a-641df0705aaa","name":"For receiver","originalRequest":{"method":"GET","header":[],"url":"http://localhost:3003/api/me/invitations"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"sent\": [],\n    \"received\": [\n        {\n            \"id\": 323,\n            \"invitor\": {\n                \"id\": 595,\n                \"username\": \"anhtumai\",\n                \"name\": \"Anh Tu Mai\"\n            },\n            \"invitee\": {\n                \"id\": 599,\n                \"username\": \"secondtestuser\",\n                \"name\": \"Second Test User\"\n            },\n            \"apartment\": {\n                \"id\": 136,\n                \"name\": \"HOAS Apartment\"\n            }\n        }\n    ]\n}"}],"_postman_id":"f8115d24-1f08-4499-b5c8-bc7dbbd1bc9d"},{"name":"GET /api/me/tasks","id":"45d895a7-8368-4512-9997-18348275cbc0","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":false},"method":"GET","header":[],"url":"http://localhost:3003/api/me/tasks","description":"<p>Get all tasks that are requested or assigned to you</p>\n<p>Requires:</p>\n<ul>\n<li>Token authentication</li>\n</ul>\n","urlObject":{"path":["api","me","tasks"],"host":["http://localhost:3003"],"query":[],"variable":[]}},"response":[{"id":"92900274-1833-442b-81af-04f46555e390","name":"Get Apartment","originalRequest":{"method":"GET","header":[],"url":"http://localhost:3003/api/me/tasks"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"requests\": [\n        {\n            \"id\": 204,\n            \"state\": \"pending\",\n            \"task\": {\n                \"id\": 72,\n                \"name\": \"Clean the kitchen\",\n                \"description\": \"clean the sink, ...\",\n                \"frequency\": 2,\n                \"difficulty\": 6,\n                \"start\": \"2021-08-31T21:00:00.000Z\",\n                \"end\": \"2022-08-31T21:00:00.000Z\",\n                \"creator_id\": 595\n            }\n        }\n    ],\n    \"assignments\": [\n        {\n            \"id\": 136,\n            \"order\": 0,\n            \"task\": {\n                \"id\": 71,\n                \"name\": \"Clean the bathroom\",\n                \"description\": \"clean the toilet, clean what the fuck, ......\",\n                \"frequency\": 2,\n                \"difficulty\": 10,\n                \"start\": \"2021-08-31T21:00:00.000Z\",\n                \"end\": \"2022-08-31T21:00:00.000Z\",\n                \"creator_id\": 595\n            }\n        }\n    ]\n}"},{"id":"3ed21bfc-7078-40b7-9296-af65772e1a8d","name":"Get Apartment when you dont have apartment","originalRequest":{"method":"GET","header":[],"url":"http://localhost:3003/api/me/tasks"},"status":"No Content","code":204,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":""}],"_postman_id":"45d895a7-8368-4512-9997-18348275cbc0"},{"name":"POST /api/invitations","id":"8d299e18-f7c0-42da-827b-32f19c829f79","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":false},"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"username\": \"firsttestuser\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/invitations","description":"<p>Create new invitation to invite other people to join your apartment.</p>\n<p>Conditions:</p>\n<ul>\n<li>You must be a member of an apartment</li>\n<li>user with <code>username</code> must exist</li>\n<li>he/she must not live in another apartment</li>\n</ul>\n","urlObject":{"path":["api","invitations"],"host":["http://localhost:3003"],"query":[],"variable":[]}},"response":[{"id":"afcccbd4-796b-4cd8-9d48-866f2aebdd7a","name":"Create Valid Invitation","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"username\": \"firsttestuser\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/invitations"},"status":"Created","code":201,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"id\": 322,\n    \"invitor\": {\n        \"id\": 595,\n        \"username\": \"anhtumai\",\n        \"name\": \"Anh Tu Mai\"\n    },\n    \"invitee\": {\n        \"id\": 598,\n        \"username\": \"firsttestuser\",\n        \"name\": \"First Test User\"\n    },\n    \"apartment\": {\n        \"id\": 136,\n        \"name\": \"HOAS Apartment\"\n    }\n}"},{"id":"fd31a31d-bed1-4656-bda0-c0cfa4c149f1","name":"Create Invitation to non-existing user","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"username\": \"nonexistinguser\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/invitations"},"status":"Not Found","code":404,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"error\": \"ConditionNotMeet error: nonexistinguser does not exist\"\n}"},{"id":"694fc1e8-c5fe-4dcb-8fb6-948e501dc180","name":"Create Invitation when you are not in an apartment","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"username\": \"secondtestuser\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/invitations"},"status":"Bad Request","code":400,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"error\": \"ConditionNotMeet error: You are not the member of any apartments\"\n}"},{"id":"a9ef35b7-da3b-4083-84ae-1ba3a44dc4f7","name":"Create second invitation to an user","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"username\": \"firsttestuser\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/invitations"},"status":"Bad Request","code":400,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"error\": \"Conflict error: You had sent an invitation to this person\"\n}"}],"_postman_id":"8d299e18-f7c0-42da-827b-32f19c829f79"},{"name":"POST /api/invitations/:id/reject","id":"ea7a71f1-e37b-4dbf-bd6f-8e2fd92092fb","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImZpcnN0dGVzdHVzZXIiLCJpZCI6NTk4LCJpYXQiOjE2MzIzNzcwNDUsImV4cCI6MTYzMjM4Nzg0NX0.8UvSio3m4GxgYxGXdwSnrI0oaheCxiJ5rcQ5zzPARIA"}]},"isInherited":false},"method":"POST","header":[],"url":"http://localhost:3003/api/invitations/325/reject","description":"<p>Reject an invitation sent from another user.\nThe invitation will be deleted.</p>\n<p>Requires:</p>\n<ul>\n<li>Token authentication</li>\n</ul>\n","urlObject":{"path":["api","invitations","325","reject"],"host":["http://localhost:3003"],"query":[],"variable":[]}},"response":[{"id":"5f4b22d8-d232-408d-8664-d596ff9f075a","name":"Reject Invitation","originalRequest":{"method":"POST","header":[],"url":"http://localhost:3003/api/invitations/325/reject"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"msg\": \"Reject invitation to HOAS Apartment from anhtumai\"\n}"},{"id":"769a0e6b-79aa-4b9b-b5e9-0c5c418f9676","name":"Reject Invitation for other people","originalRequest":{"method":"POST","header":[],"url":"http://localhost:3003/api/invitations/326/reject"},"status":"Forbidden","code":403,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"error\": \"Forbidden error\"\n}"}],"_postman_id":"ea7a71f1-e37b-4dbf-bd6f-8e2fd92092fb"},{"name":"POST /api/invitations/:id/accept","id":"f2e825b7-3636-4926-841d-3ce6701856ca","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImZpcnN0dGVzdHVzZXIiLCJpZCI6NTk4LCJpYXQiOjE2MzIzNzcwNDUsImV4cCI6MTYzMjM4Nzg0NX0.8UvSio3m4GxgYxGXdwSnrI0oaheCxiJ5rcQ5zzPARIA"}]},"isInherited":false},"method":"POST","header":[],"url":"http://localhost:3003/api/invitations/513/accept","description":"<p>Accept an invitation from another user.\nAll other invitations sent to you will be deleted. After that, you will become apartment member.</p>\n<p>Requires:</p>\n<ul>\n<li>Token authentication</li>\n</ul>\n","urlObject":{"path":["api","invitations","513","accept"],"host":["http://localhost:3003"],"query":[],"variable":[]}},"response":[{"id":"85f7492c-a0b9-427e-9ca7-de458e7b8dea","name":"Accept Invitation","originalRequest":{"method":"POST","header":[],"url":"http://localhost:3003/api/invitations/326/accept"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"msg\": \"Accept invitation to HOAS Apartment from anhtumai\"\n}"},{"id":"ee3adc51-66b4-4f41-9fe4-b032c8f397b2","name":"Accept Invitation for other people","originalRequest":{"method":"POST","header":[],"url":"http://localhost:3003/api/invitations/326/reject"},"status":"Forbidden","code":403,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"error\": \"Forbidden error\"\n}"}],"_postman_id":"f2e825b7-3636-4926-841d-3ce6701856ca"},{"name":"DELETE /api/invitations/:id","id":"f276243b-2bd6-4edc-8801-284a51faf8af","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":false},"method":"DELETE","header":[],"url":"http://localhost:3003/api/invitations/323","description":"<p>Cancel an invitation sent to another user</p>\n<p>Requires:</p>\n<ul>\n<li>Token authentication</li>\n<li>You must be the creator of this invitation</li>\n</ul>\n","urlObject":{"path":["api","invitations","323"],"host":["http://localhost:3003"],"query":[],"variable":[]}},"response":[{"id":"ae7e13fe-e1b5-494a-afe2-48847aed01db","name":"Cancel invitation","originalRequest":{"method":"DELETE","header":[],"url":"http://localhost:3003/api/invitations/323"},"status":"No Content","code":204,"_postman_previewlanguage":null,"header":null,"cookie":[],"responseTime":null,"body":null},{"id":"744de781-76ce-4965-b075-913ef59c2e25","name":"Cancel Invitation with Invalid ID","originalRequest":{"method":"DELETE","header":[],"url":"http://localhost:3003/api/invitations/1"},"status":"Forbidden","code":403,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"error\": \"Forbidden error\"\n}"}],"_postman_id":"f276243b-2bd6-4edc-8801-284a51faf8af"},{"name":"GET /api/tasks/:id","id":"2574e31d-6c2f-45b6-94fb-567453f1a92d","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":false},"method":"GET","header":[],"url":"http://localhost:3003/api/tasks/71","description":"<p>Get information about a specific task.</p>\n<p>Requires:</p>\n<ul>\n<li>Token authentication</li>\n<li>You must be the roommate of the creator of this task</li>\n</ul>\n","urlObject":{"path":["api","tasks","71"],"host":["http://localhost:3003"],"query":[],"variable":[]}},"response":[{"id":"a61807c4-2937-4e2d-9278-496bfe33af81","name":"If task is in request","originalRequest":{"method":"GET","header":[],"url":"http://localhost:3003/api/tasks/71"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"task\": {\n        \"id\": 73,\n        \"name\": \"Clean the kitchen\",\n        \"description\": \"clean the sink, ...\",\n        \"frequency\": 2,\n        \"difficulty\": 6,\n        \"start\": \"2021-08-31T21:00:00.000Z\",\n        \"end\": \"2022-08-31T21:00:00.000Z\",\n        \"creator_id\": 595\n    },\n    \"requests\": [\n        {\n            \"id\": 207,\n            \"state\": \"pending\",\n            \"assigner\": {\n                \"id\": 595,\n                \"name\": \"Anh Tu Mai\",\n                \"username\": \"anhtumai\"\n            }\n        },\n        {\n            \"id\": 208,\n            \"state\": \"pending\",\n            \"assigner\": {\n                \"id\": 598,\n                \"name\": \"First Test User\",\n                \"username\": \"firsttestuser\"\n            }\n        },\n        {\n            \"id\": 209,\n            \"state\": \"pending\",\n            \"assigner\": {\n                \"id\": 599,\n                \"name\": \"Second Test User\",\n                \"username\": \"secondtestuser\"\n            }\n        }\n    ]\n}"},{"id":"faf1637f-cee8-4d50-be02-605681a9af58","name":"If task is in assignment","originalRequest":{"method":"GET","header":[],"url":"http://localhost:3003/api/tasks/71"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"task\": {\n        \"id\": 71,\n        \"name\": \"Clean the bathroom\",\n        \"description\": \"clean the toilet, clean what the fuck, ......\",\n        \"frequency\": 2,\n        \"difficulty\": 10,\n        \"start\": \"2021-08-31T21:00:00.000Z\",\n        \"end\": \"2022-08-31T21:00:00.000Z\",\n        \"creator_id\": 595\n    },\n    \"assignments\": [\n        {\n            \"id\": 138,\n            \"order\": 0,\n            \"assigner\": {\n                \"id\": 599,\n                \"name\": \"Second Test User\",\n                \"username\": \"secondtestuser\"\n            }\n        },\n        {\n            \"id\": 137,\n            \"order\": 1,\n            \"assigner\": {\n                \"id\": 598,\n                \"name\": \"First Test User\",\n                \"username\": \"firsttestuser\"\n            }\n        },\n        {\n            \"id\": 136,\n            \"order\": 2,\n            \"assigner\": {\n                \"id\": 595,\n                \"name\": \"Anh Tu Mai\",\n                \"username\": \"anhtumai\"\n            }\n        }\n    ]\n}"}],"_postman_id":"2574e31d-6c2f-45b6-94fb-567453f1a92d"},{"name":"POST /api/tasks","id":"733a7fb6-002a-45bd-ad60-48372c5be2a8","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":false},"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"name\": \"Clean the livingroom 2\",\n    \"description\": \"clean the dining table, ...\",\n    \"frequency\": 2,\n    \"difficulty\":10,\n    \"start\": \"01 Sep 2021\",\n    \"end\": \"01 Sep 2022\",\n    \"assignees\": [\"anhtumai\", \"secondtestuser\"]\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/tasks","description":"<p>Create new task and send requests to assignees.</p>\n<p>Conditions:</p>\n<ul>\n<li>Task properties must be in correct type</li>\n<li><code>assignees</code> is a list of usernames</li>\n</ul>\n","urlObject":{"path":["api","tasks"],"host":["http://localhost:3003"],"query":[],"variable":[]}},"response":[{"id":"9aad08dd-6ec9-4443-8140-313002229b1b","name":"Create new task","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"name\": \"Clean the livingroom 2\",\n    \"description\": \"clean the dining table, ...\",\n    \"frequency\": 2,\n    \"difficulty\":10,\n    \"start\": \"01 Sep 2021\",\n    \"end\": \"01 Sep 2022\",\n    \"assignees\": [\"anhtumai\", \"secondtestuser\"]\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/tasks"},"status":"Created","code":201,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"name\": \"Clean the livingroom 2\",\n    \"description\": \"clean the dining table, ...\",\n    \"frequency\": 2,\n    \"difficulty\":10,\n    \"start\": \"01 Sep 2021\",\n    \"end\": \"01 Sep 2022\",\n    \"assignees\": [\"anhtumai\", \"secondtestuser\"]\n}"},{"id":"bc38cf2e-e45f-4929-9998-a39768dc7678","name":"Create new task with invalid property","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"name\": \"Clean the bathroom\",\n    \"description\": \"clean the toilet, ...\",\n    \"frequency\": 2,\n    \"difficulty\":6,\n    \"start\": \"Invalid Date\",\n    \"end\": 2022,\n    \"assignees\": [\"anhtumai\", \"firsttestuser\", \"secondtestuser\"]\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/tasks"},"status":"Created","code":201,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"error\": \"Invalid body\"\n}"},{"id":"57175011-2fcd-421a-80db-70e3fa4f9ecf","name":"Create new task with non-existing assginers","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"name\": \"Clean the bathroom\",\n    \"description\": \"clean the toilet, ...\",\n    \"frequency\": 2,\n    \"difficulty\":6,\n    \"start\": \"01 Sep 2021\",\n    \"end\": \"01 Sep 2022\",\n    \"assignees\": [\"nonexist1\", \"nonexist2\", \"secondtestuser\"]\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/tasks"},"status":"Bad Request","code":400,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"error\": \"NotFound error: usernames: nonexist1,nonexist2 are not member of this apartment\"\n}"}],"_postman_id":"733a7fb6-002a-45bd-ad60-48372c5be2a8"},{"name":"PUT /api/tasks/:id","id":"a67f1a7a-1607-46c8-9a49-25813d2e6577","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImZpcnN0dGVzdHVzZXIiLCJpZCI6NTk4LCJpYXQiOjE2MzIzNzcwNDUsImV4cCI6MTYzMjM4Nzg0NX0.8UvSio3m4GxgYxGXdwSnrI0oaheCxiJ5rcQ5zzPARIA"}]},"isInherited":false},"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\n    \"name\": \"Clean the bathroom\",\n    \"description\": \"clean the toilet, clean what the fuck, ......\",\n    \"frequency\": 2,\n    \"difficulty\": 10,\n    \"start\": \"2021-08-31T21:00:00.000Z\",\n    \"end\": \"2022-08-31T21:00:00.000Z\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/tasks/71","description":"<p>Change property of a task</p>\n<p>Requires:</p>\n<ul>\n<li>Token authentication</li>\n<li>Only creator and admin can do that</li>\n</ul>\n","urlObject":{"path":["api","tasks","71"],"host":["http://localhost:3003"],"query":[],"variable":[]}},"response":[{"id":"1440d43d-1ca9-43e6-b68f-65ac7cec95c5","name":"Update Task","originalRequest":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\n    \"name\": \"Clean the bathroom\",\n    \"description\": \"clean the toilet, clean what the fuck, ......\",\n    \"frequency\": 4,\n    \"difficulty\": 6,\n    \"start\": \"2021-08-31T21:00:00.000Z\",\n    \"end\": \"2022-08-31T21:00:00.000Z\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/tasks/71"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"id\": 71,\n    \"name\": \"Clean the bathroom\",\n    \"description\": \"clean the toilet, clean what the fuck, ......\",\n    \"frequency\": 4,\n    \"difficulty\": 6,\n    \"start\": \"2021-08-31T21:00:00.000Z\",\n    \"end\": \"2022-08-31T21:00:00.000Z\",\n    \"creator_id\": 595\n}"},{"id":"da8c6fd5-a303-40b4-975a-0ed961d4efd0","name":"Update Task with invalid ID","originalRequest":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\n    \"name\": \"Clean the bathroom\",\n    \"description\": \"clean the toilet, clean what the fuck, ......\",\n    \"frequency\": 2,\n    \"difficulty\": 10,\n    \"start\": \"2021-08-31T21:00:00.000Z\",\n    \"end\": \"2022-08-31T21:00:00.000Z\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/tasks/17"},"status":"Forbidden","code":403,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"error\": \"Forbidden error\"\n}"},{"id":"17039d82-686c-40cb-b946-53d8b011303d","name":"Update Task when you are not creator or admin","originalRequest":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\n    \"name\": \"Clean the bathroom\",\n    \"description\": \"clean the toilet, clean what the fuck, ......\",\n    \"frequency\": 2,\n    \"difficulty\": 10,\n    \"start\": \"2021-08-31T21:00:00.000Z\",\n    \"end\": \"2022-08-31T21:00:00.000Z\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/tasks/71"},"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"error\": \"Forbidden error\"\n}"}],"_postman_id":"a67f1a7a-1607-46c8-9a49-25813d2e6577"},{"name":"DELETE /api/tasks/:id","id":"8c6ad9cd-b74b-46dc-8c20-3e329996009c","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":false},"method":"DELETE","header":[],"url":"http://localhost:3003/api/tasks/84","description":"<p>Delete a task, as well as its requests and assignments</p>\n<p>Requires:</p>\n<ul>\n<li>Token authentication</li>\n<li>Only creator and admin can do that</li>\n</ul>\n","urlObject":{"path":["api","tasks","84"],"host":["http://localhost:3003"],"query":[],"variable":[]}},"response":[{"id":"4e78c3c3-2d55-4bf5-881a-06a3981ae434","name":"Delete Task","originalRequest":{"method":"DELETE","header":[],"url":"http://localhost:3003/api/tasks/72"},"status":"No Content","code":204,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":""},{"id":"6967466e-5660-4748-9442-5309885a9581","name":"Delete Task with Invalid Id","originalRequest":{"method":"DELETE","header":[],"url":"http://localhost:3003/api/tasks/72"},"status":"Forbidden","code":403,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"error\": \"Forbidden error\"\n}"}],"_postman_id":"8c6ad9cd-b74b-46dc-8c20-3e329996009c"},{"name":"PATCH /api/taskrequests/:id","id":"f0726493-e6fe-4f02-a8a7-79ca6ac8d1c3","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":false},"method":"PATCH","header":[],"body":{"mode":"raw","raw":"{\n    \"state\": \"accepted\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/taskrequests/201","description":"<p>Change the state of a task request to \"rejected\", \"accepted\" or \"pending\"</p>\n<p>Requires:</p>\n<ul>\n<li>Token authentication</li>\n<li>Only assignee can accept or reject</li>\n</ul>\n","urlObject":{"path":["api","taskrequests","201"],"host":["http://localhost:3003"],"query":[],"variable":[]}},"response":[{"id":"91585e90-a0ef-4796-bb40-065eb85822e6","name":"Accept","originalRequest":{"method":"PATCH","header":[],"body":{"mode":"raw","raw":"{\n    \"state\": \"accepted\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/taskrequests/39"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"msg\": \"Task request id 202 is now accepted\"\n}"},{"id":"ce3e0e17-1789-41f4-9eed-2fc63c6003a9","name":"Reject","originalRequest":{"method":"PATCH","header":[],"body":{"mode":"raw","raw":"{\n    \"state\": \"rejected\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/taskrequests/39"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"msg\": \"Task request id 203 is now rejected\"\n}"},{"id":"87236825-5c7b-4ce9-b68f-3199968fd1ec","name":"Invalid ID","originalRequest":{"method":"PATCH","header":[],"body":{"mode":"raw","raw":"{\n    \"state\": \"accepted\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/taskrequests/201"},"status":"Forbidden","code":403,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"error\": \"Forbidden error\"\n}"}],"_postman_id":"f0726493-e6fe-4f02-a8a7-79ca6ac8d1c3"},{"name":"PUT /api/tasks/:id/order","id":"19e1c119-a319-41d1-8663-c9263176aa8a","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":false},"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\n    \"order\": [\"secondtestuser\", \"anhtumai\"]\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/tasks/71/order","description":"<p>Change order of task assignment. <code>order</code> is a list of usernames.</p>\n<p><code>order</code>: [\"user1\", \"user2\", \"user3\"] means user1 will do the task in Week 1, Week 4, user2 will do in Week 2, user3 will do in week 3.</p>\n<p>Requires:</p>\n<ul>\n<li>Token authentication</li>\n<li>Only creator and admin can do that</li>\n</ul>\n","urlObject":{"path":["api","tasks","71","order"],"host":["http://localhost:3003"],"query":[],"variable":[]}},"response":[{"id":"da3ade26-0fee-4f3c-90a3-66c20f8244da","name":"Change Order of Assignment","originalRequest":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\n    \"order\": [\"secondtestuser\", \"firsttestuser\", \"anhtumai\"]\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/tasks/71/order"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"order\": [\n        \"secondtestuser\",\n        \"firsttestuser\",\n        \"anhtumai\"\n    ]\n}"},{"id":"b4c6e876-cec4-4068-9cfc-947a61981a6d","name":"Change Order of Assignment with invalid body","originalRequest":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\n    \"order\": [\"secondtestuser\", \"firsttestuser\", \"anhtumai\"]\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/tasks/71/order"},"status":"Bad Request","code":400,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"error\": \"Invalid body: Orders must contain all member usernames\"\n}"}],"_postman_id":"19e1c119-a319-41d1-8663-c9263176aa8a"},{"name":"PUT /api/tasks/:id/assignees","id":"54ceaa92-2a6d-48d6-a711-b001c48acf38","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":false},"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\n    \"assignees\": [\"anhtumai\", \"firsttestuser\", \"secondtestuser\"]\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/tasks/126/assignees","description":"<p>Change assignees for a task. <code>assignees</code> is a list of usernames</p>\n<p>this call will delete all requests or assignments, and create new requests for new assignees</p>\n<p>Requires:</p>\n<ul>\n<li>Token authentication</li>\n<li>Only creator and admin can do that</li>\n</ul>\n","urlObject":{"path":["api","tasks","126","assignees"],"host":["http://localhost:3003"],"query":[],"variable":[]}},"response":[{"id":"bf760ef6-0630-49dc-a9f6-890c76c5441a","name":"Change Assignees","originalRequest":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\n    \"assignees\": [\"secondtestuser\", \"firsttestuser\", \"anhtumai\"]\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/tasks/126/assignees"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"assignees\": [\n        \"anhtumai\",\n        \"firsttestuser\",\n        \"secondtestuser\"\n    ]\n}"},{"id":"065ffdc8-e0c0-41b5-861a-906cf4dba771","name":"Change Assignees with invalid body","originalRequest":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\n    \"assignees\": [\"anhfasdtumai\", \"firsttestuasfasdfser\", \"anhtumai\"]\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3003/api/tasks/126/assignees"},"status":"Bad Request","code":400,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"error\": \"NotFound error: user(s) anhfasdtumai,firsttestuasfasdfser are not member of this apartment\"\n}"}],"_postman_id":"54ceaa92-2a6d-48d6-a711-b001c48acf38"}],"event":[{"listen":"prerequest","script":{"id":"2063674d-f70c-4284-91ad-4a79ead5266b","type":"text/javascript","exec":["const loginUrl = pm.collectionVariables.get(\"newUrl\") + \"/api/auth/login\";","","pm.sendRequest({","    url: loginUrl,","    method: \"POST\",","    header: {","        'content-type': 'application/json'","    },","    body: {","        mode: 'raw',","        raw: JSON.stringify({","            \"username\": \"anhtumai\",","            \"password\": \"anhtumaipassword\"","        })","    }","}, function(err, res) {","    console.log(res.json().token)","    pm.collectionVariables.set(\"token\", res.json().token)","})","","pm.sendRequest({","    url: loginUrl,","    method: \"POST\",","    header: {","        'content-type': 'application/json'","    },","    body: {","        mode: 'raw',","        raw: JSON.stringify({","            \"username\": \"firsttestuser\",","            \"password\": \"firsttestuserpassword\"","        })","    }","}, function(err, res) {","    console.log(res.json().token)","    pm.collectionVariables.set(\"token2\", res.json().token)","})","","pm.sendRequest({","    url: loginUrl,","    method: \"POST\",","    header: {","        'content-type': 'application/json'","    },","    body: {","        mode: 'raw',","        raw: JSON.stringify({","            \"username\": \"secondtestuser\",","            \"password\": \"secondtestuserpassword\"","        })","    }","}, function(err, res) {","    console.log(res.json().token)","    pm.collectionVariables.set(\"token3\", res.json().token)","})"]}},{"listen":"test","script":{"id":"89a24c0c-22a1-42f7-8e90-ea31971563bb","type":"text/javascript","exec":[""]}}],"variable":[{"key":"base_url","value":"http://localhost:3003"},{"key":"token","value":""},{"key":"token2","value":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImZpcnN0dGVzdHVzZXIiLCJpZCI6NTk4LCJpYXQiOjE2MzIzNzcwNDUsImV4cCI6MTYzMjM4Nzg0NX0.8UvSio3m4GxgYxGXdwSnrI0oaheCxiJ5rcQ5zzPARIA"},{"key":"token3","value":""},{"key":"token4","value":""},{"key":"newUrl","value":"","type":"string"}]}