diff --git a/backend/apis/BlinkApiUsageExample.json b/backend/apis/BlinkApiUsageExample.json index ca18b2c..fbdf667 100644 --- a/backend/apis/BlinkApiUsageExample.json +++ b/backend/apis/BlinkApiUsageExample.json @@ -1 +1 @@ -{"_type":"export","__export_format":4,"__export_date":"2024-03-20T11:18:48.027Z","__export_source":"insomnia.desktop.app:v2023.5.8","resources":[{"_id":"req_40787a35a87f4668b707029c1898c793","parentId":"wrk_839dd6bf2a0b4ee78fda12f7930031e2","modified":1710925703679,"created":1710780008983,"url":"http://localhost:3000/api/organizations/4/joboffers/","name":"GetJobOffers","description":"","method":"GET","body":{},"parameters":[],"headers":[{"name":"User-Agent","value":"insomnia/2023.5.8","id":"pair_e2f80e0338ce4532aa3dfdfb580aaccc"}],"authentication":{},"metaSortKey":-1710780008983,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"wrk_839dd6bf2a0b4ee78fda12f7930031e2","parentId":null,"modified":1710326090851,"created":1710326090851,"name":"Blink","description":"","scope":"collection","_type":"workspace"},{"_id":"req_c6a773c0abea4da9a4ca2eb255180500","parentId":"wrk_839dd6bf2a0b4ee78fda12f7930031e2","modified":1710925546535,"created":1710772767420,"url":"http://localhost:3000/api/organizations/joboffers/34","name":"DeleteJobOffer","description":"","method":"DELETE","body":{},"parameters":[],"headers":[{"name":"User-Agent","value":"insomnia/2023.5.8","id":"pair_f5b506a6f1144612b4bc5ab25d7412bf"},{"id":"pair_f0b38fdd99bc48c3beb3759c1b76d4f9","name":"authorization","value":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwZXJzb25faWQiOjIsImlhdCI6MTcxMDkyNTM3OCwiZXhwIjoxNzEwOTU0MTc4fQ.x11sy1lAFQw9ycW_ZmNyjKiYCLolZA1udwvUujerrwA","description":""}],"authentication":{},"metaSortKey":-1710772767420,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_cb2f4d1c1a4248659a4e70fcf896d575","parentId":"wrk_839dd6bf2a0b4ee78fda12f7930031e2","modified":1710925502771,"created":1710759450846,"url":"http://localhost:3000/api/organizations/6/joboffers","name":"CreateJobOffer","description":"","method":"POST","body":{"mimeType":"application/json","text":"{\n\t\"title\" : \"NodeJS developer\",\n\t\"description\" : \"We are looking for NodeJS developers which can help us build Blink\",\n\t\"requirements\": \"English, NodeJS/Javascript experience\",\n\t\"salary\": \"0\",\n\t\"salary_frequency\": \"HOUR\",\n\t\"salary_currency\": \"EUR\",\n\t\"location\" : \"Full Remote\",\n\t\"tags\" : [\"javascript\"]\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_ab45fbd8abca47dbabee1cd0e8ca18c1"},{"name":"User-Agent","value":"insomnia/2023.5.8","id":"pair_fa676590c908421a9994ab1c320ff117"},{"id":"pair_b2d0e1a0770d434ab219a925583a354b","name":"authorization","value":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwZXJzb25faWQiOjIsImlhdCI6MTcxMDkyNTM3OCwiZXhwIjoxNzEwOTU0MTc4fQ.x11sy1lAFQw9ycW_ZmNyjKiYCLolZA1udwvUujerrwA","description":""}],"authentication":{},"metaSortKey":-1710759450846,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_fd69a8d1662c48e2bbd778579ed935ce","parentId":"wrk_839dd6bf2a0b4ee78fda12f7930031e2","modified":1710775016433,"created":1698054725162,"url":"http://localhost:3000/api/organizations/3/admins/me","name":"RemoveOrganizationAdmin","description":"","method":"DELETE","body":{"mimeType":"application/json","text":""},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_96dd7956eedd4029a62a8953d48384fd"},{"name":"User-Agent","value":"insomnia/2023.5.8","id":"pair_5b4b316379204e8a9f34ad6b8520cf02"},{"id":"pair_0f33ba2fe5aa4a9c9610531991a08fff","name":"authorization","value":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwZXJzb25faWQiOjIsImlhdCI6MTcxMDc3NDk3MywiZXhwIjoxNzEwODAzNzczfQ.AY1EZUMMADzCLeBKceNF-QlbWEscaJBjkaz1vo--lVY","description":""}],"authentication":{},"metaSortKey":-1698054725162,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_c41c7925ed8b42578c9c4d2ee69ce8ef","parentId":"wrk_839dd6bf2a0b4ee78fda12f7930031e2","modified":1710925490400,"created":1697612039148,"url":"http://localhost:3000/api/organizations/6/admins","name":"AddOrganizationAdmin","description":"","method":"POST","body":{"mimeType":"application/json","text":"{\n\t\"person_id\" : \"3\"\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_7f6436f6c14046f881b4325c0401f678"},{"name":"User-Agent","value":"insomnia/2023.5.8","id":"pair_17a5c397cc2d44d58a70ad0f3ef13d5b"},{"id":"pair_56656674434c4b5f9eb6616c7b662fc1","name":"authorization","value":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwZXJzb25faWQiOjIsImlhdCI6MTcxMDkyNTM3OCwiZXhwIjoxNzEwOTU0MTc4fQ.x11sy1lAFQw9ycW_ZmNyjKiYCLolZA1udwvUujerrwA","description":""}],"authentication":{},"metaSortKey":-1697612039148,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_82bdc353d1b148dbb49591141cdbcd72","parentId":"wrk_839dd6bf2a0b4ee78fda12f7930031e2","modified":1710775011790,"created":1697439750530,"url":"http://localhost:3000/api/organizations/posts/1","name":"DeleteOrganizationPost","description":"","method":"DELETE","body":{"mimeType":"application/json","text":""},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_1cf0a9865fc54eb28b06b007dcfb87b6"},{"name":"User-Agent","value":"insomnia/2023.5.8","id":"pair_e116a62c90714a2fa936db757b86345a"},{"id":"pair_af07de8a9e584d74bf22de772a1a5116","name":"authorization","value":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwZXJzb25faWQiOjIsImlhdCI6MTcxMDc3NDk3MywiZXhwIjoxNzEwODAzNzczfQ.AY1EZUMMADzCLeBKceNF-QlbWEscaJBjkaz1vo--lVY","description":""}],"authentication":{},"metaSortKey":-1697439750530,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_6f528a68ae444533a8e4b017d0d44e9c","parentId":"wrk_839dd6bf2a0b4ee78fda12f7930031e2","modified":1710925471567,"created":1697443352055,"url":"http://localhost:3000/api/organizations/6/posts/","name":"CreateOrganizationPost","description":"","method":"POST","body":{"mimeType":"application/json","text":"{\n\t\"content\" : \"Reach to us on Blink!\"\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_6e74726d8b9d4be883fb296363f27e4c"},{"name":"User-Agent","value":"insomnia/2023.5.8","id":"pair_e355a0ac56664aaa95d1fba431f09a9c"},{"id":"pair_639ce915c16a4e36b23c5eec89acb7c2","name":"authorization","value":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwZXJzb25faWQiOjIsImlhdCI6MTcxMDkyNTM3OCwiZXhwIjoxNzEwOTU0MTc4fQ.x11sy1lAFQw9ycW_ZmNyjKiYCLolZA1udwvUujerrwA","description":""}],"authentication":{},"metaSortKey":-1697439606468.5,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_75837537026545599267a8ab860fa597","parentId":"wrk_839dd6bf2a0b4ee78fda12f7930031e2","modified":1710928878955,"created":1710927856445,"url":"http://localhost:3000/api/organizations/filter","name":"FilterOrganizationByPrefix","description":"","method":"POST","body":{"mimeType":"application/json","text":"{\n\t\"name\" : \"bli\"\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json"},{"name":"User-Agent","value":"insomnia/2023.5.8"}],"authentication":{},"metaSortKey":-1697439570453.125,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_188afe0ee1984760b373b83a0310a970","parentId":"wrk_839dd6bf2a0b4ee78fda12f7930031e2","modified":1710775006690,"created":1697536019056,"url":"http://localhost:3000/api/organizations/1","name":"DeleteOrganization","description":"","method":"DELETE","body":{},"parameters":[],"headers":[{"name":"User-Agent","value":"insomnia/2023.5.8","id":"pair_b65bf581b26e4d73b696c173b04c04a2"},{"id":"pair_5b4068cf97244ee8b89f977adaec08a1","name":"authorization","value":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwZXJzb25faWQiOjIsImlhdCI6MTcxMDc3NDk3MywiZXhwIjoxNzEwODAzNzczfQ.AY1EZUMMADzCLeBKceNF-QlbWEscaJBjkaz1vo--lVY","description":""}],"authentication":{},"metaSortKey":-1697439534437.75,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_45fb794ba51f433699814045c62c21ba","parentId":"wrk_839dd6bf2a0b4ee78fda12f7930031e2","modified":1710925461726,"created":1697722213218,"url":"http://localhost:3000/api/organizations/6","name":"UpdateOrganization","description":"","method":"PATCH","body":{"mimeType":"application/json","text":"{\n\t\"name\" : \"Blink Inc.\",\n\t\"location\" : \"Naples (Campania), Italy\",\n\t\"description\" : \"Blink is a privacy-respecting business-oriented social media platform focused on fostering connections between businesses and individuals, propelling careers and sparking innovation in the professional world. Think of it as an open-source alternative to LinkedIn.\",\n\"is_hiring\": true\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_fc5a2e2b439942a6ae18401fd037d0b9"},{"name":"User-Agent","value":"insomnia/2023.5.8","id":"pair_164bb1219a27446fa2f897510640bb94"},{"id":"pair_e998ceb2025440638d70aa62f0cba85b","name":"authorization","value":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwZXJzb25faWQiOjIsImlhdCI6MTcxMDkyNTM3OCwiZXhwIjoxNzEwOTU0MTc4fQ.x11sy1lAFQw9ycW_ZmNyjKiYCLolZA1udwvUujerrwA","description":""}],"authentication":{},"metaSortKey":-1697439516430.0625,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_803a7d2873fb409ba75d7775b37994a6","parentId":"wrk_839dd6bf2a0b4ee78fda12f7930031e2","modified":1710925416129,"created":1697614353582,"url":"http://localhost:3000/api/organizations/6","name":"GetOrganization","description":"","method":"GET","body":{},"parameters":[],"headers":[{"name":"User-Agent","value":"insomnia/2023.5.8","id":"pair_bf5a8e159b4440ad92054d78cf787432"}],"authentication":{},"metaSortKey":-1697439498422.375,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_c575bc65569d40368e11d90380d76378","parentId":"wrk_839dd6bf2a0b4ee78fda12f7930031e2","modified":1710925408172,"created":1697439462407,"url":"http://localhost:3000/api/organizations","name":"CreateOrganization","description":"","method":"POST","body":{"mimeType":"application/json","text":"{\n\t\"name\" : \"Blink 501c3\",\n\t\"location\" : \"Napoli, Italy\",\n\t\"description\" : \"Blink is a privacy-respecting business-oriented social media platform focused on fostering connections between businesses and individuals, propelling careers and sparking innovation in the professional world.\",\n\t\"is_hiring\" : true\n}"},"parameters":[{"id":"pair_fbb851a173414199aabb5612a4afbe79","name":"","value":"","description":""}],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_e97d33e8311c469d9930459e52897eea"},{"name":"User-Agent","value":"insomnia/2023.5.8","id":"pair_d25e174d5f1f4268a348f03b3df16cb7"},{"id":"pair_1718cff2285c40649a4f026ffd5f66aa","name":"authorization","value":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwZXJzb25faWQiOjIsImlhdCI6MTcxMDkyNTM3OCwiZXhwIjoxNzEwOTU0MTc4fQ.x11sy1lAFQw9ycW_ZmNyjKiYCLolZA1udwvUujerrwA","description":""}],"authentication":{},"metaSortKey":-1697439462407,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_1f0cd0b4190547e28dc3f77b60512aee","parentId":"wrk_839dd6bf2a0b4ee78fda12f7930031e2","modified":1710774995133,"created":1697535452268,"url":"http://localhost:3000/api/persons/me","name":"DeletePerson","description":"","method":"DELETE","body":{},"parameters":[],"headers":[{"name":"User-Agent","value":"insomnia/2023.5.8","id":"pair_f6ccd1a246fd4f468bc67d1d93aaeba9"},{"id":"pair_3c52bb529c5641758476066fbf9420a2","name":"authorization","value":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwZXJzb25faWQiOjIsImlhdCI6MTcxMDc3NDk3MywiZXhwIjoxNzEwODAzNzczfQ.AY1EZUMMADzCLeBKceNF-QlbWEscaJBjkaz1vo--lVY","description":""}],"authentication":{},"metaSortKey":-1697235183758.625,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_f8586ad9edb643dd8adf71faa781d083","parentId":"wrk_839dd6bf2a0b4ee78fda12f7930031e2","modified":1710925395786,"created":1697719914121,"url":"http://localhost:3000/api/persons/me","name":"UpdatePerson","description":"","method":"PATCH","body":{"mimeType":"application/json","text":"{\n\t\"display_name\": \"John Doe\",\n\t\"date_of_birth\": \"1970-01-01\",\n\t\"available\": \"false\",\n\t\"new_password\": \"password\",\n\t\"old_password\": \"password\",\n\t\"qualification\" : \"Software Engineer at Blink Inc.\",\n\t\"about_me\" : \"I am a passionate software developer, with great interest in science and maths\"\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_48550a7ad35b41778139f1efea6d6d52"},{"name":"User-Agent","value":"insomnia/2023.5.8","id":"pair_050cd5497a3247779057ebfa8df9f7af"},{"id":"pair_009590274cc1470b9265940e398e8c40","name":"authorization","value":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwZXJzb25faWQiOjIsImlhdCI6MTcxMDkyNTM3OCwiZXhwIjoxNzEwOTU0MTc4fQ.x11sy1lAFQw9ycW_ZmNyjKiYCLolZA1udwvUujerrwA","description":""}],"authentication":{},"metaSortKey":-1697133044434.4375,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_7fd44c015e564167a91f444e3f63bf05","parentId":"wrk_839dd6bf2a0b4ee78fda12f7930031e2","modified":1710925391191,"created":1708354567080,"url":"http://localhost:3000/api/persons/me","name":"GetMyself","description":"","method":"GET","body":{},"parameters":[],"headers":[{"name":"User-Agent","value":"insomnia/2023.5.8","id":"pair_fbdfeef3bb9b45b0aaa4d137cd9cd56c"},{"id":"pair_2d3b8d4c6a48459789363053fc3a5c3e","name":"authorization","value":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwZXJzb25faWQiOjIsImlhdCI6MTcxMDkyNTM3OCwiZXhwIjoxNzEwOTU0MTc4fQ.x11sy1lAFQw9ycW_ZmNyjKiYCLolZA1udwvUujerrwA","description":""}],"authentication":{},"metaSortKey":-1697081974772.3438,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_b8b79705dc814259b4aa24ca5f22db89","parentId":"wrk_839dd6bf2a0b4ee78fda12f7930031e2","modified":1710923588855,"created":1697452790733,"url":"http://localhost:3000/api/persons/2/details","name":"GetPerson","description":"","method":"GET","body":{},"parameters":[],"headers":[{"name":"User-Agent","value":"insomnia/2023.5.8","id":"pair_f979eeb78d5d484b87bb2142931bfe88"}],"authentication":{},"metaSortKey":-1697030905110.25,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_040647911ca3424fbb7e3f008f02ea81","parentId":"wrk_839dd6bf2a0b4ee78fda12f7930031e2","modified":1710326148436,"created":1709544547074,"url":"http://localhost:3000/api/persons/me/activation?q=3ac9c204de1676b54163ed8015c7af00","name":"ActivatePerson","description":"","method":"GET","body":{"mimeType":"application/json","text":""},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json"},{"name":"User-Agent","value":"insomnia/2023.5.8"}],"authentication":{},"metaSortKey":-1696826626461.875,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_8f3238c7331a476cb043a4d421065582","parentId":"wrk_839dd6bf2a0b4ee78fda12f7930031e2","modified":1710760392658,"created":1697439499759,"url":"http://localhost:3000/api/persons/me/token","name":"Login","description":"","method":"POST","body":{"mimeType":"application/json","text":"{\n\t\"email\": \"john@mail.org\",\n\t\"password\": \"password\"\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json"},{"name":"User-Agent","value":"insomnia/2023.5.8"}],"authentication":{},"metaSortKey":-1696622347813.5,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_78ea05e44b4c4e6ea6bac729d071356d","parentId":"wrk_839dd6bf2a0b4ee78fda12f7930031e2","modified":1710923566107,"created":1695805233220,"url":"http://localhost:3000/api/persons","name":"Register","description":"","method":"POST","body":{"mimeType":"application/json","text":"{\n\t\"email\" : \"john@mail.org\",\n\t\"password\" : \"password\",\n\t\"display_name\" : \"John Doe\",\n\t\"about_me\" : \"I am a passionate software engineer\",\n\t\"qualification\" : \"Software Engineer\"\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_4995c469a16542358ad1b61eb49793f1"},{"name":"User-Agent","value":"insomnia/2023.5.8","id":"pair_85a8fc0b1f9540cf9b89da7b801ec746"}],"authentication":{"type":"bearer"},"metaSortKey":-1695805233220,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"env_1d70e76c520b4be09cc9f809cb9d255a","parentId":"wrk_839dd6bf2a0b4ee78fda12f7930031e2","modified":1695805230956,"created":1695805230956,"name":"Base Environment","data":{},"dataPropertyOrder":null,"color":null,"isPrivate":false,"metaSortKey":1695805230956,"_type":"environment"},{"_id":"jar_b506ac3b9f044646b588e018a44690a0","parentId":"wrk_839dd6bf2a0b4ee78fda12f7930031e2","modified":1695805230957,"created":1695805230957,"name":"Default Jar","cookies":[],"_type":"cookie_jar"}]} \ No newline at end of file +{"_type":"export","__export_format":4,"__export_date":"2024-03-21T15:53:22.318Z","__export_source":"insomnia.desktop.app:v2023.5.8","resources":[{"_id":"req_470ea70dacf5457e9285c96080b123ca","parentId":"wrk_467396595b6f468aa658414cec14c306","modified":1710925703679,"created":1710780008983,"url":"http://localhost:3000/api/organizations/4/joboffers/","name":"GetJobOffers","description":"","method":"GET","body":{},"parameters":[],"headers":[{"name":"User-Agent","value":"insomnia/2023.5.8","id":"pair_e2f80e0338ce4532aa3dfdfb580aaccc"}],"authentication":{},"metaSortKey":-1710780008983,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"wrk_467396595b6f468aa658414cec14c306","parentId":null,"modified":1711013722452,"created":1711013722452,"name":"Blink","description":"","scope":"collection","_type":"workspace"},{"_id":"req_8eb6a338cbaf4cbfb283481e4955debb","parentId":"wrk_467396595b6f468aa658414cec14c306","modified":1711036376465,"created":1710772767420,"url":"http://localhost:3000/api/organizations/joboffers/34","name":"DeleteJobOffer","description":"","method":"DELETE","body":{},"parameters":[],"headers":[{"name":"User-Agent","value":"insomnia/2023.5.8","id":"pair_f5b506a6f1144612b4bc5ab25d7412bf"}],"authentication":{"type":"bearer","token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwZXJzb25faWQiOjIsImlhdCI6MTcxMTAzMjk1NCwiZXhwIjoxNzExMDYxNzU0fQ.5el1ymu9qZQpoJpWfM4ZPfNcs34GGFc6WVfCBitlyEk"},"metaSortKey":-1710772767420,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_c91b3a34a4b54dfe82404e54248d5ca6","parentId":"wrk_467396595b6f468aa658414cec14c306","modified":1711036370433,"created":1710759450846,"url":"http://localhost:3000/api/organizations/6/joboffers","name":"CreateJobOffer","description":"","method":"POST","body":{"mimeType":"application/json","text":"{\n\t\"title\" : \"NodeJS developer\",\n\t\"description\" : \"We are looking for NodeJS developers which can help us build Blink\",\n\t\"requirements\": \"English, NodeJS/Javascript experience\",\n\t\"salary\": \"0\",\n\t\"salary_frequency\": \"HOUR\",\n\t\"salary_currency\": \"EUR\",\n\t\"location\" : \"Full Remote\",\n\t\"tags\" : [\"javascript\"]\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_ab45fbd8abca47dbabee1cd0e8ca18c1"},{"name":"User-Agent","value":"insomnia/2023.5.8","id":"pair_fa676590c908421a9994ab1c320ff117"}],"authentication":{"type":"bearer","token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwZXJzb25faWQiOjIsImlhdCI6MTcxMTAzMjk1NCwiZXhwIjoxNzExMDYxNzU0fQ.5el1ymu9qZQpoJpWfM4ZPfNcs34GGFc6WVfCBitlyEk"},"metaSortKey":-1710759450846,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_126ce2a4fc464c07a6b2ece4ba4aeab3","parentId":"wrk_467396595b6f468aa658414cec14c306","modified":1711036363445,"created":1698054725162,"url":"http://localhost:3000/api/organizations/3/admins/me","name":"RemoveOrganizationAdmin","description":"","method":"DELETE","body":{"mimeType":"application/json","text":""},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_96dd7956eedd4029a62a8953d48384fd"},{"name":"User-Agent","value":"insomnia/2023.5.8","id":"pair_5b4b316379204e8a9f34ad6b8520cf02"}],"authentication":{"type":"bearer","token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwZXJzb25faWQiOjIsImlhdCI6MTcxMTAzMjk1NCwiZXhwIjoxNzExMDYxNzU0fQ.5el1ymu9qZQpoJpWfM4ZPfNcs34GGFc6WVfCBitlyEk"},"metaSortKey":-1698054725162,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_9b2ccbca74214f0f9bbc602251635669","parentId":"wrk_467396595b6f468aa658414cec14c306","modified":1711036356402,"created":1697612039148,"url":"http://localhost:3000/api/organizations/6/admins","name":"AddOrganizationAdmin","description":"","method":"POST","body":{"mimeType":"application/json","text":"{\n\t\"person_id\" : \"3\"\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_7f6436f6c14046f881b4325c0401f678"},{"name":"User-Agent","value":"insomnia/2023.5.8","id":"pair_17a5c397cc2d44d58a70ad0f3ef13d5b"}],"authentication":{"type":"bearer","token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwZXJzb25faWQiOjIsImlhdCI6MTcxMTAzMjk1NCwiZXhwIjoxNzExMDYxNzU0fQ.5el1ymu9qZQpoJpWfM4ZPfNcs34GGFc6WVfCBitlyEk"},"metaSortKey":-1697612039148,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_25d08b1c63364d878c28a6cc67cacb6f","parentId":"wrk_467396595b6f468aa658414cec14c306","modified":1711036347784,"created":1697439750530,"url":"http://localhost:3000/api/organizations/posts/1","name":"DeleteOrganizationPost","description":"","method":"DELETE","body":{"mimeType":"application/json","text":""},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_1cf0a9865fc54eb28b06b007dcfb87b6"},{"name":"User-Agent","value":"insomnia/2023.5.8","id":"pair_e116a62c90714a2fa936db757b86345a"}],"authentication":{"type":"bearer","token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwZXJzb25faWQiOjIsImlhdCI6MTcxMTAzMjk1NCwiZXhwIjoxNzExMDYxNzU0fQ.5el1ymu9qZQpoJpWfM4ZPfNcs34GGFc6WVfCBitlyEk"},"metaSortKey":-1697439750530,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_72f048f133de490e8bae6c48c2c09b60","parentId":"wrk_467396595b6f468aa658414cec14c306","modified":1711036340614,"created":1697443352055,"url":"http://localhost:3000/api/organizations/6/posts/","name":"CreateOrganizationPost","description":"","method":"POST","body":{"mimeType":"application/json","text":"{\n\t\"content\" : \"Reach to us on Blink!\"\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_6e74726d8b9d4be883fb296363f27e4c"},{"name":"User-Agent","value":"insomnia/2023.5.8","id":"pair_e355a0ac56664aaa95d1fba431f09a9c"}],"authentication":{"type":"bearer","token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwZXJzb25faWQiOjIsImlhdCI6MTcxMTAzMjk1NCwiZXhwIjoxNzExMDYxNzU0fQ.5el1ymu9qZQpoJpWfM4ZPfNcs34GGFc6WVfCBitlyEk"},"metaSortKey":-1697439606468.5,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_41615e54d96647f5ba496c9c99fc7682","parentId":"wrk_467396595b6f468aa658414cec14c306","modified":1710928878955,"created":1710927856445,"url":"http://localhost:3000/api/organizations/filter","name":"FilterOrganizationByPrefix","description":"","method":"POST","body":{"mimeType":"application/json","text":"{\n\t\"name\" : \"bli\"\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json"},{"name":"User-Agent","value":"insomnia/2023.5.8"}],"authentication":{},"metaSortKey":-1697439570453.125,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_7aab411531e84b759ca24487db1b4db7","parentId":"wrk_467396595b6f468aa658414cec14c306","modified":1711036329079,"created":1697536019056,"url":"http://localhost:3000/api/organizations/1","name":"DeleteOrganization","description":"","method":"DELETE","body":{},"parameters":[],"headers":[{"name":"User-Agent","value":"insomnia/2023.5.8","id":"pair_b65bf581b26e4d73b696c173b04c04a2"}],"authentication":{"type":"bearer","token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwZXJzb25faWQiOjIsImlhdCI6MTcxMTAzMjk1NCwiZXhwIjoxNzExMDYxNzU0fQ.5el1ymu9qZQpoJpWfM4ZPfNcs34GGFc6WVfCBitlyEk"},"metaSortKey":-1697439534437.75,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_d870e4652d064749bc6b6975183e075c","parentId":"wrk_467396595b6f468aa658414cec14c306","modified":1711036318157,"created":1697722213218,"url":"http://localhost:3000/api/organizations/6","name":"UpdateOrganization","description":"","method":"PATCH","body":{"mimeType":"application/json","text":"{\n\t\"name\" : \"Blink Inc.\",\n\t\"location\" : \"Naples (Campania), Italy\",\n\t\"description\" : \"Blink is a privacy-respecting business-oriented social media platform focused on fostering connections between businesses and individuals, propelling careers and sparking innovation in the professional world. Think of it as an open-source alternative to LinkedIn.\",\n\"is_hiring\": true\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_fc5a2e2b439942a6ae18401fd037d0b9"},{"name":"User-Agent","value":"insomnia/2023.5.8","id":"pair_164bb1219a27446fa2f897510640bb94"}],"authentication":{"type":"bearer","token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwZXJzb25faWQiOjIsImlhdCI6MTcxMTAzMjk1NCwiZXhwIjoxNzExMDYxNzU0fQ.5el1ymu9qZQpoJpWfM4ZPfNcs34GGFc6WVfCBitlyEk"},"metaSortKey":-1697439516430.0625,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_98b0c23af41c4ba78fe513be0d08f536","parentId":"wrk_467396595b6f468aa658414cec14c306","modified":1710925416129,"created":1697614353582,"url":"http://localhost:3000/api/organizations/6","name":"GetOrganization","description":"","method":"GET","body":{},"parameters":[],"headers":[{"name":"User-Agent","value":"insomnia/2023.5.8","id":"pair_bf5a8e159b4440ad92054d78cf787432"}],"authentication":{},"metaSortKey":-1697439498422.375,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_b2e4dd19d56f4d0687da6dbc70af37fc","parentId":"wrk_467396595b6f468aa658414cec14c306","modified":1711036303582,"created":1697439462407,"url":"http://localhost:3000/api/organizations","name":"CreateOrganization","description":"","method":"POST","body":{"mimeType":"application/json","text":"{\n\t\"name\" : \"Blink 501c3\",\n\t\"location\" : \"Napoli, Italy\",\n\t\"description\" : \"Blink is a privacy-respecting business-oriented social media platform focused on fostering connections between businesses and individuals, propelling careers and sparking innovation in the professional world.\",\n\t\"is_hiring\" : true\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_e97d33e8311c469d9930459e52897eea"},{"name":"User-Agent","value":"insomnia/2023.5.8","id":"pair_d25e174d5f1f4268a348f03b3df16cb7"}],"authentication":{"type":"bearer","token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwZXJzb25faWQiOjIsImlhdCI6MTcxMTAzMjk1NCwiZXhwIjoxNzExMDYxNzU0fQ.5el1ymu9qZQpoJpWfM4ZPfNcs34GGFc6WVfCBitlyEk"},"metaSortKey":-1697439462407,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_8a6e15c60a6a4db3b7bcfff494400eeb","parentId":"wrk_467396595b6f468aa658414cec14c306","modified":1711036287819,"created":1697535452268,"url":"http://localhost:3000/api/persons/me","name":"DeletePerson","description":"","method":"DELETE","body":{},"parameters":[],"headers":[{"name":"User-Agent","value":"insomnia/2023.5.8","id":"pair_f6ccd1a246fd4f468bc67d1d93aaeba9"}],"authentication":{"type":"bearer","token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwZXJzb25faWQiOjIsImlhdCI6MTcxMTAzMjk1NCwiZXhwIjoxNzExMDYxNzU0fQ.5el1ymu9qZQpoJpWfM4ZPfNcs34GGFc6WVfCBitlyEk"},"metaSortKey":-1697235183758.625,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_27698b57da924af28de06deafcf6ddf7","parentId":"wrk_467396595b6f468aa658414cec14c306","modified":1711036271486,"created":1697719914121,"url":"http://localhost:3000/api/persons/me","name":"UpdatePerson","description":"","method":"PATCH","body":{"mimeType":"application/json","text":"{\n\t\"display_name\": \"John Doe\",\n\t\"date_of_birth\": \"1970-01-01\",\n\t\"available\": \"false\",\n\t\"new_password\": \"password\",\n\t\"old_password\": \"password\",\n\t\"qualification\" : \"Software Engineer at Blink Inc.\",\n\t\"about_me\" : \"I am a passionate software developer, with great interest in science and maths\"\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_48550a7ad35b41778139f1efea6d6d52"},{"name":"User-Agent","value":"insomnia/2023.5.8","id":"pair_050cd5497a3247779057ebfa8df9f7af"}],"authentication":{"type":"bearer","token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwZXJzb25faWQiOjIsImlhdCI6MTcxMTAzMjk1NCwiZXhwIjoxNzExMDYxNzU0fQ.5el1ymu9qZQpoJpWfM4ZPfNcs34GGFc6WVfCBitlyEk"},"metaSortKey":-1697133044434.4375,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_f083a7216bcb41309f5b4348db62f6b9","parentId":"wrk_467396595b6f468aa658414cec14c306","modified":1711035929257,"created":1708354567080,"url":"http://localhost:3000/api/persons/me","name":"GetMyself","description":"","method":"GET","body":{},"parameters":[],"headers":[{"name":"User-Agent","value":"insomnia/2023.5.8","id":"pair_fbdfeef3bb9b45b0aaa4d137cd9cd56c"}],"authentication":{"type":"bearer","token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwZXJzb25faWQiOjIsImlhdCI6MTcxMTAzMjk1NCwiZXhwIjoxNzExMDYxNzU0fQ.5el1ymu9qZQpoJpWfM4ZPfNcs34GGFc6WVfCBitlyEk"},"metaSortKey":-1697081974772.3438,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_664ec4dd847d4ef9a05b4c8eccf15709","parentId":"wrk_467396595b6f468aa658414cec14c306","modified":1710923588855,"created":1697452790733,"url":"http://localhost:3000/api/persons/2/details","name":"GetPerson","description":"","method":"GET","body":{},"parameters":[],"headers":[{"name":"User-Agent","value":"insomnia/2023.5.8","id":"pair_f979eeb78d5d484b87bb2142931bfe88"}],"authentication":{},"metaSortKey":-1697030905110.25,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_85f92262c9a04bfcaa9d48cac64c7c18","parentId":"wrk_467396595b6f468aa658414cec14c306","modified":1710326148436,"created":1709544547074,"url":"http://localhost:3000/api/persons/me/activation?q=3ac9c204de1676b54163ed8015c7af00","name":"ActivatePerson","description":"","method":"GET","body":{"mimeType":"application/json","text":""},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json"},{"name":"User-Agent","value":"insomnia/2023.5.8"}],"authentication":{},"metaSortKey":-1696826626461.875,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_400198ced7364849b18f41b2172fe94c","parentId":"wrk_467396595b6f468aa658414cec14c306","modified":1710760392658,"created":1697439499759,"url":"http://localhost:3000/api/persons/me/token","name":"Login","description":"","method":"POST","body":{"mimeType":"application/json","text":"{\n\t\"email\": \"john@mail.org\",\n\t\"password\": \"password\"\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json"},{"name":"User-Agent","value":"insomnia/2023.5.8"}],"authentication":{},"metaSortKey":-1696622347813.5,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_c11bf4bc6da7425faa29ff689095f59f","parentId":"wrk_467396595b6f468aa658414cec14c306","modified":1710923566107,"created":1695805233220,"url":"http://localhost:3000/api/persons","name":"Register","description":"","method":"POST","body":{"mimeType":"application/json","text":"{\n\t\"email\" : \"john@mail.org\",\n\t\"password\" : \"password\",\n\t\"display_name\" : \"John Doe\",\n\t\"about_me\" : \"I am a passionate software engineer\",\n\t\"qualification\" : \"Software Engineer\"\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_4995c469a16542358ad1b61eb49793f1"},{"name":"User-Agent","value":"insomnia/2023.5.8","id":"pair_85a8fc0b1f9540cf9b89da7b801ec746"}],"authentication":{"type":"bearer"},"metaSortKey":-1695805233220,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"env_7437e477b4be4cc3a95e5674dcd23b36","parentId":"wrk_467396595b6f468aa658414cec14c306","modified":1695805230956,"created":1695805230956,"name":"Base Environment","data":{},"dataPropertyOrder":null,"color":null,"isPrivate":false,"metaSortKey":1695805230956,"_type":"environment"},{"_id":"jar_62d7227146f34b55bbf2121afb1e959d","parentId":"wrk_467396595b6f468aa658414cec14c306","modified":1695805230957,"created":1695805230957,"name":"Default Jar","cookies":[],"_type":"cookie_jar"}]} \ No newline at end of file diff --git a/backend/apis/nodejs/src/routes/job_offer_routes.js b/backend/apis/nodejs/src/routes/job_offer_routes.js index 7730a59..8552fe9 100644 --- a/backend/apis/nodejs/src/routes/job_offer_routes.js +++ b/backend/apis/nodejs/src/routes/job_offer_routes.js @@ -100,8 +100,8 @@ async function findByOrganizationId(req, res) { const routes = express.Router(); routes.get('/:id/joboffers', findByOrganizationId); -routes.post('/:id/joboffers', jwtUtils.verifyToken, insert); -routes.delete('/joboffers/:jobOfferId', jwtUtils.verifyToken, remove); +routes.post('/:id/joboffers', jwtUtils.extractToken, insert); +routes.delete('/joboffers/:jobOfferId', jwtUtils.extractToken, remove); module.exports = { routes diff --git a/backend/apis/nodejs/src/routes/organization_admin_routes.js b/backend/apis/nodejs/src/routes/organization_admin_routes.js index 6da7434..406ec8e 100644 --- a/backend/apis/nodejs/src/routes/organization_admin_routes.js +++ b/backend/apis/nodejs/src/routes/organization_admin_routes.js @@ -78,8 +78,8 @@ async function removeOrganizationAdmin(req, res) { } const routes = express.Router(); -routes.post('/:organizationId/admins', jwtUtils.verifyToken, organizationAdminValidator.addOrganizationAdminValidator, addOrganizationAdmin); -routes.delete('/:organizationId/admins/me', jwtUtils.verifyToken, organizationAdminValidator.removeOrganizationAdminValidator, removeOrganizationAdmin); +routes.post('/:organizationId/admins', jwtUtils.extractToken, organizationAdminValidator.addOrganizationAdminValidator, addOrganizationAdmin); +routes.delete('/:organizationId/admins/me', jwtUtils.extractToken, organizationAdminValidator.removeOrganizationAdminValidator, removeOrganizationAdmin); module.exports = { routes diff --git a/backend/apis/nodejs/src/routes/organization_post_routes.js b/backend/apis/nodejs/src/routes/organization_post_routes.js index e9af012..a4d0e25 100644 --- a/backend/apis/nodejs/src/routes/organization_post_routes.js +++ b/backend/apis/nodejs/src/routes/organization_post_routes.js @@ -95,8 +95,8 @@ async function deleteOrganizationPost(req, res) { } const routes = express.Router(); -routes.post('/:idOrganization/posts', jwtUtils.verifyToken, createOrganizationPost); -routes.delete('/posts/:id', jwtUtils.verifyToken, deleteOrganizationPost); +routes.post('/:idOrganization/posts', jwtUtils.extractToken, createOrganizationPost); +routes.delete('/posts/:id', jwtUtils.extractToken, deleteOrganizationPost); // Exporting a function // means making a JavaScript function defined in one diff --git a/backend/apis/nodejs/src/routes/organization_routes.js b/backend/apis/nodejs/src/routes/organization_routes.js index 9c5545e..ccd5a8b 100644 --- a/backend/apis/nodejs/src/routes/organization_routes.js +++ b/backend/apis/nodejs/src/routes/organization_routes.js @@ -181,15 +181,15 @@ async function filter(req, res) { } } -// Here we can not use the jwtUtils.verifyToken as the Router's middleware directly, as the latter +// Here we can not use the jwtUtils.extractToken as the Router's middleware directly, as the latter // will be mounted under /organizations, but there are other resources under /organizations // that do not require the authorization, e.g. job offers const routes = express.Router(); routes.get('/:id', organizationValidator.deleteOrGetOrganizationValidator, getOrganization); routes.post('/filter', organizationValidator.filterValidator, filter); -routes.post('/', jwtUtils.verifyToken, organizationValidator.createOrganizationValidator, createOrganization); -routes.patch('/:id', jwtUtils.verifyToken, organizationValidator.updateOrganizationValidator, updateOrganization); -routes.delete('/:id', jwtUtils.verifyToken, organizationValidator.deleteOrGetOrganizationValidator, deleteOrganization); +routes.post('/', jwtUtils.extractToken, organizationValidator.createOrganizationValidator, createOrganization); +routes.patch('/:id', jwtUtils.extractToken, organizationValidator.updateOrganizationValidator, updateOrganization); +routes.delete('/:id', jwtUtils.extractToken, organizationValidator.deleteOrGetOrganizationValidator, deleteOrganization); module.exports = { routes diff --git a/backend/apis/nodejs/src/routes/person_routes.js b/backend/apis/nodejs/src/routes/person_routes.js index bc0ec37..ebca732 100644 --- a/backend/apis/nodejs/src/routes/person_routes.js +++ b/backend/apis/nodejs/src/routes/person_routes.js @@ -329,7 +329,7 @@ publicRoutes.get('/:id/details', getPerson); publicRoutes.post('/me/activation', personValidator.confirmActivationValidator, confirmActivation); const protectedRoutes = express.Router(); // Routes requiring token -protectedRoutes.use(jwtUtils.verifyToken); +protectedRoutes.use(jwtUtils.extractToken); protectedRoutes.get('/me', getMyself); protectedRoutes.patch('/me', personValidator.updatePersonValidator, updatePerson); protectedRoutes.delete('/me', deletePerson); diff --git a/backend/apis/nodejs/src/utils/jwt_utils.js b/backend/apis/nodejs/src/utils/jwt_utils.js index 071905d..c4701bb 100644 --- a/backend/apis/nodejs/src/utils/jwt_utils.js +++ b/backend/apis/nodejs/src/utils/jwt_utils.js @@ -25,31 +25,40 @@ function generateToken(person_id) { return token; } -// Middlware -function verifyToken(req, res, next) { - const token = req.headers.authorization; +/** + * Verifies the validity of the token. If it is valid, + * sets the req.jwt property to the decoded object + * contained within the jwt + */ +function extractToken(req, res, next) { - if (!token) { + const authHeader = req.headers.authorization; + + // Obtain the token using the Bearer scheme + // The Bearer token, contained in the header, has the following + // structure: "Bearer " + if (authHeader && authHeader.startsWith('Bearer ')) { + const token = authHeader.substring(7); + try { + const decoded = jwt.verify(token, process.env.JWT_SECRET_KEY); + // If the token is valid, store the decoded data in the request object + // req.jwt will contain the payload created in generateToken + req.jwt = decoded; + next(); + } catch (error) { + return res.status(401).send({ + error: 'Failed to authenticate token' + }); + } + } else { return res.status(401).send({ error: 'No token provided' }); } - jwt.verify(token, process.env.JWT_SECRET_KEY, (err, decoded) => { - if (err) { - return res.status(401).send({ - error: 'Failed to authenticate token' - }); - } - - // If the token is valid, store the decoded data in the request object - // req.jwt will contain the payload created in generateToken - req.jwt = decoded; - next(); - }); } module.exports = { generateToken, - verifyToken + extractToken }; \ No newline at end of file