Skip to content
Merged
1 change: 1 addition & 0 deletions Insomnia.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"_type":"export","__export_format":4,"__export_date":"2024-11-24T23:14:46.850Z","__export_source":"insomnia.desktop.app:v10.1.1","resources":[{"_id":"req_948bfd43a65748ecab5c987289f77572","parentId":"fld_dcce4119355f4b059748237bdfce26f6","modified":1732488415392,"created":1732487891610,"url":"{{ _.URL }}/","name":"/","description":"# /api/\nCheck that the API is live.\n\nShould return \n```\n{\n\t\"success\": true\n}\n```","method":"GET","body":{},"parameters":[],"headers":[{"name":"User-Agent","value":"insomnia/10.1.1"}],"authentication":{},"metaSortKey":-1732487891610,"isPrivate":false,"pathParameters":[],"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"fld_dcce4119355f4b059748237bdfce26f6","parentId":"wrk_ebb0ac5223db40d19f738d66df835a70","modified":1732489771305,"created":1732487889273,"name":"root","description":"","environment":{},"environmentPropertyOrder":null,"metaSortKey":-1732489768419,"_type":"request_group"},{"_id":"wrk_ebb0ac5223db40d19f738d66df835a70","parentId":null,"modified":1732487793436,"created":1732487793436,"name":"clowder.cloud backend","description":"","scope":"collection","_type":"workspace"},{"_id":"req_998cafeddbbd4b8daad792705b4372ff","parentId":"fld_dcce4119355f4b059748237bdfce26f6","modified":1732488469497,"created":1732487945191,"url":"{{ _.URL }}/endpoints","name":"/endpoints","description":"# /api/endpoints\nList all available endpoints\n\nShould return \n```\n{\n\t\"success\": true,\n\t\"data\": {\n\t\t\t\"/api\": {\n\t\t\t\"description\": \"Index of API\",\n\t\t\t\"method\": \"GET\",\n\t\t\t\"authentication\": \"none\",\n\t\t\t\"result\": {\n\t\t\t\t\"success\": true\n\t\t\t}\n\t\t},\n\t\t\"/api/endpoints\": {\n\t\t\t\"description\": \"List all endpoints\",\n\t\t\t\"method\": \"GET\",\n\t\t\t\"authentication\": \"none\",\n\t\t\t\"result\": {\n\t\t\t\t\"success\": true,\n\t\t\t\t\"data\": {\n\t\t\t\t\t\"/api\": {\n\t\t\t\t\t\t\"description\": \"Index of API\",\n\t\t\t\t\t\t\"method\": \"GET\",\n\t\t\t\t\t\t\"authentication\": \"none\",\n\t\t\t\t\t\t\"result\": {\n\t\t\t\t\t\t\t\"success\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[...]\n\t}\n}\n```","method":"GET","body":{},"parameters":[],"headers":[{"name":"User-Agent","value":"insomnia/10.1.1"}],"authentication":{},"metaSortKey":-1732487891510,"isPrivate":false,"pathParameters":[],"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_e46e034b474046adbeb1c34c62a7c79b","parentId":"fld_1efa4a942b1b42969e010017b9145e2d","modified":1732489531846,"created":1732487990528,"url":"{{ _.URL }}/devices/create","name":"/devices/create - Create a new device","description":"# /api/devices/create\nCreate a new GPS device\n\nRequires Authorization header, set to the users username\n\nShould return \n```\n{\n\t\"success\": true,\n\t\"data\": {\n\t\t\"id\": \"...\",\n\t\t\"name\": \"GPS Device\",\n\t\t\"uuid\": \"...\",\n\t\t\"owner_id\": \"cm3op7iwu0000jrcqa60tc9kv\",\n\t\t\"last_pulse_at\": null,\n\t\t\"last_location\": {},\n\t\t\"location_history\": [],\n\t\t\"updated_at\": \"...\",\n\t\t\"created_at\": \"...\"\n\t}\n}\n```","method":"POST","body":{},"parameters":[],"headers":[{"name":"User-Agent","value":"insomnia/10.1.1"}],"authentication":{"type":"apikey","disabled":false,"key":"Authorization","value":"{{ _.username }}","addTo":"header"},"metaSortKey":-1732487990528,"isPrivate":false,"pathParameters":[],"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"fld_1efa4a942b1b42969e010017b9145e2d","parentId":"wrk_ebb0ac5223db40d19f738d66df835a70","modified":1732489772761,"created":1732487975283,"name":"devices","description":"","environment":{},"environmentPropertyOrder":null,"metaSortKey":-1732489768369,"_type":"request_group"},{"_id":"req_93f69d6521da42678ec5ab4c7d98400a","parentId":"fld_1efa4a942b1b42969e010017b9145e2d","modified":1732489005849,"created":1732488085659,"url":"{{ _.URL }}/devices/update","name":"/devices/update - Send GPS update","description":"# /api/devices/update\nSend data to the server as a GPS device\n\nBody should be\n```\n{\n\t\"id\": \"device-id\",\n\t\"lat\": 41.303921,\n\t\"lon\": -81.901693\n}\n```\n\nShould return no content","method":"POST","body":{"mimeType":"application/json","text":"{\n\t\"id\": \"{{ _.device_id }}\",\n\t\"lat\": 41.303921,\n\t\"lon\": -81.901693\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json"},{"name":"User-Agent","value":"insomnia/10.1.1"}],"authentication":{},"metaSortKey":-1732487990428,"isPrivate":false,"pathParameters":[],"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_24d8b3a7097942dd90e0c71980c673f9","parentId":"fld_1efa4a942b1b42969e010017b9145e2d","modified":1732489538168,"created":1732488584419,"url":"{{ _.URL }}/devices/delete","name":"/devices/delete - Delete a device","description":"# /api/devices/delete\nDelete a GPS device\n\nRequires Authorization header, set to the users username\n\nBody should be\n```\n{\n\t\"device_uuid\": \"device-uuid\"\n}\n```\n\nShould return no content","method":"DELETE","body":{"mimeType":"application/json","text":"{\n\t\"device_uuid\": \"5804f943-4aaf-432f-83d8-62028827ac57\"\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json"},{"name":"User-Agent","value":"insomnia/10.1.1"}],"authentication":{"type":"apikey","disabled":false,"key":"Authorization","value":"{{ _.username }}","addTo":"header"},"metaSortKey":-1732487990328,"isPrivate":false,"pathParameters":[],"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_4fb0c3b413294accb886f261b14991b3","parentId":"fld_ebbc47c05c414d7b9947d639e6728464","modified":1732489344154,"created":1732489081735,"url":"{{ _.URL }}/users/{{ _.user_id }}/devices","name":"/users/:id/devices - List a users devices","description":"# /api/users/:id/devices\nList all of a users devices\n\nShould return\n```\n{\n\t\"success\": true,\n\t\"data\": [\n\t\t{\n\t\t\t\"id\": \"...\",\n\t\t\t\"name\": \"GPS Device\",\n\t\t\t\"uuid\": \"...\",\n\t\t\t\"owner_id\": \"...\",\n\t\t\t\"last_pulse_at\": null,\n\t\t\t\"last_location\": {},\n\t\t\t\"location_history\": [],\n\t\t\t\"updated_at\": \"...\",\n\t\t\t\"created_at\": \"...\"\n\t\t},\n\t\t[...]\n\t]\n}\n```","method":"GET","body":{},"parameters":[],"headers":[{"name":"User-Agent","value":"insomnia/10.1.1"}],"authentication":{},"metaSortKey":-1732489081735,"isPrivate":false,"pathParameters":[],"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"fld_ebbc47c05c414d7b9947d639e6728464","parentId":"wrk_ebb0ac5223db40d19f738d66df835a70","modified":1732489773829,"created":1732489057407,"name":"users","description":"","environment":{},"environmentPropertyOrder":null,"metaSortKey":-1732489768344,"_type":"request_group"},{"_id":"req_63797c7aba5640898e361eea2561eab4","parentId":"fld_ebbc47c05c414d7b9947d639e6728464","modified":1732489357937,"created":1732489264494,"url":"{{ _.URL }}/users/{{ _.user_id }}/cats","name":"/users/:id/cats - List a users cats","description":"# /api/users/:id/cats\nList all of a users cats\n\nShould return\n```\n{\n\t\"success\": true,\n\t\"data\": [\n\t\t{\n\t\t\t\"id\": \"...\",\n\t\t\t\"name\": \"...\",\n\t\t\t\"description\": \"...\",\n\t\t\t\"picture_url\": \"...\",\n\t\t\t\"device_id\": \"...\",\n\t\t\t\"owner_id\": \"...\",\n\t\t\t\"updated_at\": \"...\",\n\t\t\t\"created_at\": \"...\"\n\t\t},\n\t\t[...]\n\t]\n}\n```","method":"GET","body":{},"parameters":[],"headers":[{"name":"User-Agent","value":"insomnia/10.1.1"}],"authentication":{},"metaSortKey":-1732489081635,"isPrivate":false,"pathParameters":[],"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_d270d1cb76064600a7f48cbf254c06fe","parentId":"fld_ebbc47c05c414d7b9947d639e6728464","modified":1732489611472,"created":1732489466033,"url":"{{ _.URL }}/users/settings","name":"/users/settings - Gets a user?","description":"# /api/users/settings\nGets the current user\n\nRequires Authorization header, set to the users username\n\nShould return \n```\n{\n\t\"sucess\": true,\n\t\"data\": {\n\t\t\"id\": \"...\",\n\t\t\"username\": \"...\",\n\t\t\"requested_privacy\": \"...\",\n\t\t\"updated_at\": \"...\",\n\t\t\"created_at\": \"...\"\n\t}\n}\n```","method":"GET","body":{},"parameters":[],"headers":[{"name":"User-Agent","value":"insomnia/10.1.1"}],"authentication":{"type":"apikey","disabled":false,"key":"Authorization","value":"{{ _.username }}","addTo":"header"},"metaSortKey":-1732489081535,"isPrivate":false,"pathParameters":[],"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_2f46119069964feca441869cd1baec88","parentId":"fld_ebbc47c05c414d7b9947d639e6728464","modified":1732489755238,"created":1732489578042,"url":"{{ _.URL }}/users/settings","name":"/users/settings - Update a users settings","description":"# /api/users/settings\nUpdate a users settings\n\nRequires Authorization header, set to the users username\n\nBody should be\n```\n{\n\t\"requested_privacy\": \"...\"\n}\n```\n\nShould return \n```\n{\n\t\"sucess\": true,\n\t\"data\": {\n\t\t\"id\": \"...\",\n\t\t\"username\": \"...\",\n\t\t\"requested_privacy\": \"...\",\n\t\t\"updated_at\": \"...\",\n\t\t\"created_at\": \"...\"\n\t}\n}\n```","method":"PATCH","body":{"mimeType":"application/json","text":"{\n\t\"requested_privacy\": \"PRIVATE\"\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json"},{"name":"User-Agent","value":"insomnia/10.1.1"}],"authentication":{"type":"apikey","disabled":false,"key":"Authorization","value":"{{ _.username }}","addTo":"header"},"metaSortKey":-1732489081435,"isPrivate":false,"pathParameters":[],"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_eafe0cfce8d64c348a1fc22237de6775","parentId":"fld_8f5ccbc8503e47e39e05fceef590ba66","modified":1732489891405,"created":1732489775976,"url":"{{ _.URL }}/cats/create","name":"/cats/create","description":"# /api/cats/create\nCreate a new cat\n\nRequires Authorization header, set to the users username\n\nBody should be\n```\n{\n\t\"name\": \"...\"\n}\n```\n\nShould return \n```\n{\n\t\"success\": true,\n\t\"data\": {\n\t\t\"id\": \"...\",\n\t\t\"name\": \"...\",\n\t\t\"description\": null,\n\t\t\"picture_url\": null,\n\t\t\"device_id\": null,\n\t\t\"owner_id\": \"...\",\n\t\t\"updated_at\": \"...\",\n\t\t\"created_at\": \"...\"\n\t}\n}\n```","method":"POST","body":{"mimeType":"application/json","text":"{\n\t\"name\": \"Catty Cat McCatFace\"\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json"},{"name":"User-Agent","value":"insomnia/10.1.1"}],"authentication":{"type":"apikey","disabled":false,"key":"Authorization","value":"{{ _.username }}","addTo":"header"},"metaSortKey":-1732489775976,"isPrivate":false,"pathParameters":[],"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"fld_8f5ccbc8503e47e39e05fceef590ba66","parentId":"wrk_ebb0ac5223db40d19f738d66df835a70","modified":1732489768319,"created":1732489768319,"name":"cats","description":"","environment":{},"environmentPropertyOrder":null,"metaSortKey":-1732489768319,"_type":"request_group"},{"_id":"req_6d713f50f51d41f29e62d7d68f8d9e94","parentId":"fld_8f5ccbc8503e47e39e05fceef590ba66","modified":1732490042054,"created":1732489906110,"url":"{{ _.URL }}/cats/update","name":"/cats/update","description":"# /api/cats/update\nUpdate a cat\n\nRequires Authorization header, set to the users username\n\nBody should be\n```\n{\n\t\"cat_id\": \"...\",\n\t[...]\n}\n```\n\nShould return \n```\n{\n\t\"success\": true,\n\t\"data\": {\n\t\t\"id\": \"...\",\n\t\t\"name\": \"...\",\n\t\t\"description\": \"...\",\n\t\t\"picture_url\": \"...\",\n\t\t\"device_id\": \"...\",\n\t\t\"owner_id\": \"...\",\n\t\t\"updated_at\": \"...\",\n\t\t\"created_at\": \"...\"\n\t}\n}\n```","method":"POST","body":{"mimeType":"application/json","text":"{\n\t\t\t\t\t\"cat_id\": \"cm3pz1t0v000308jka8bl7x25\",\n\t\t\t\t\t\"name\": \"Daisy, Eater of Worlds\"\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json"},{"name":"User-Agent","value":"insomnia/10.1.1"}],"authentication":{"type":"apikey","disabled":false,"key":"Authorization","value":"{{ _.username }}","addTo":"header"},"metaSortKey":-1732489775876,"isPrivate":false,"pathParameters":[],"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"env_3c19719023828d98e390eee0023d069dcca602ab","parentId":"wrk_ebb0ac5223db40d19f738d66df835a70","modified":1732488222091,"created":1732487793437,"name":"Base Environment","data":{"URL":"http://localhost:9090/api","username":"","device_id":""},"dataPropertyOrder":{"&":["URL","username","device_id"]},"color":null,"isPrivate":false,"metaSortKey":1732487793437,"_type":"environment"},{"_id":"jar_3c19719023828d98e390eee0023d069dcca602ab","parentId":"wrk_ebb0ac5223db40d19f738d66df835a70","modified":1732487793438,"created":1732487793438,"name":"Default Jar","cookies":[],"_type":"cookie_jar"},{"_id":"env_e1114f6981d446d2a4a2f913445c318c","parentId":"env_3c19719023828d98e390eee0023d069dcca602ab","modified":1732489136840,"created":1732487807740,"name":"Authorized","data":{"username":"user1","device_id":"5804f943-4aaf-432f-83d8-62028827ac57","user_id":"cm3op7iwu0000jrcqa60tc9kv"},"dataPropertyOrder":{"&":["username","device_id","user_id"]},"color":null,"isPrivate":false,"metaSortKey":1732487807741,"_type":"environment"}]}
2 changes: 1 addition & 1 deletion __tests__/app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ describe('🧪 Express Application', () => {
});
});

describe('PATCH /api/devices/update', () => {
describe('POST /api/devices/update', () => {
it('204: should return no content on successful update', () => {
const data = {
id: '5804f943-4aaf-432f-83d8-62028827ac57',
Expand Down
2 changes: 1 addition & 1 deletion src/endpoints.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
{
"path": "/api/devices/update",
"description": "Update information <GPS DEVICE>",
"method": "PATCH",
"method": "POST",
"authentication": "device-uuid",
"body": {
"id": "string",
Expand Down