diff --git a/Discord_Webhook_Example.jpg b/Discord_Webhook_Example.jpg new file mode 100644 index 0000000000000000000000000000000000000000..530b50d187325f158ba74380d8bf4e21e94c9a45 Binary files /dev/null and b/Discord_Webhook_Example.jpg differ diff --git a/GlobeBoard (Openstack).postman_collection.json b/GlobeBoard (Openstack).postman_collection.json new file mode 100644 index 0000000000000000000000000000000000000000..02f1983e85c198186381a6c25dbf6234393575f0 --- /dev/null +++ b/GlobeBoard (Openstack).postman_collection.json @@ -0,0 +1,600 @@ +{ + "info": { + "_postman_id": "8200f1ea-1d74-4172-9b92-cf2aab793249", + "name": "GlobeBoard (Openstack)", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "33039772" + }, + "item": [ + { + "name": "root", + "item": [ + { + "name": "Root (Openstack)", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "http://10.212.171.74:8080/", + "protocol": "http", + "host": [ + "10", + "212", + "171", + "74" + ], + "port": "8080", + "path": [ + "" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Register", + "item": [ + { + "name": "Register User (Openstack)", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "urlencoded", + "urlencoded": [ + { + "key": "username", + "value": "User @ Openstack", + "type": "text" + }, + { + "key": "email", + "value": "User@stud.ntnu.no", + "type": "text" + }, + { + "key": "password", + "value": "321Bananer?!", + "type": "text" + } + ] + }, + "url": { + "raw": "http://10.212.171.74:8080/util/v1/user/register", + "protocol": "http", + "host": [ + "10", + "212", + "171", + "74" + ], + "port": "8080", + "path": [ + "util", + "v1", + "user", + "register" + ] + } + }, + "response": [] + }, + { + "name": "Delete User (Localhost)", + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "http://10.212.174.226:8080/util/v1/user/delete/FNkO9jnXieeJdJgWlR1ywZQdn2F3", + "protocol": "http", + "host": [ + "10", + "212", + "174", + "226" + ], + "port": "8080", + "path": [ + "util", + "v1", + "user", + "delete", + "FNkO9jnXieeJdJgWlR1ywZQdn2F3" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Key", + "item": [ + { + "name": "API Key Get (Openstack)", + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "A8iAepCGNahMowqbevaoZDLoFTC2", + "type": "text" + } + ], + "url": { + "raw": "http://10.212.171.74:8080/util/v1/key", + "protocol": "http", + "host": [ + "10", + "212", + "171", + "74" + ], + "port": "8080", + "path": [ + "util", + "v1", + "key" + ] + } + }, + "response": [] + }, + { + "name": "API Key Delete (Openstack)", + "request": { + "method": "DELETE", + "header": [ + { + "key": "Authorization", + "value": "A8iAepCGNahMowqbevaoZDLoFTC2", + "type": "text" + } + ], + "url": { + "raw": "http://10.212.171.74:8080/util/v1/key?token=sk-jRle0weXUotOITXnVqMRtTRjPvfCFQtb8B6McDi4jaKsXi", + "protocol": "http", + "host": [ + "10", + "212", + "171", + "74" + ], + "port": "8080", + "path": [ + "util", + "v1", + "key" + ], + "query": [ + { + "key": "token", + "value": "sk-jRle0weXUotOITXnVqMRtTRjPvfCFQtb8B6McDi4jaKsXi" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Registrations", + "item": [ + { + "name": "Registration Post (Openstack)", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"country\": \"Norway\",\r\n \"isoCode\": \"NO\",\r\n \"features\": {\r\n \"temperature\": true, // this value is to be changed\r\n \"precipitation\": true,\r\n \"capital\": true,\r\n \"coordinates\": true, \r\n \"population\": true,\r\n \"area\": true,\r\n \"targetCurrencies\": [\"EUR\", \"SEK\"] // this value is to be changed\r\n }\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://10.212.171.74:8080/dashboards/v1/registrations?token=sk-7nitVmcWVrpvHYvcrmC0tTRjPvlb19wKBCynx5ZQ6lemrg", + "protocol": "http", + "host": [ + "10", + "212", + "171", + "74" + ], + "port": "8080", + "path": [ + "dashboards", + "v1", + "registrations" + ], + "query": [ + { + "key": "token", + "value": "sk-7nitVmcWVrpvHYvcrmC0tTRjPvlb19wKBCynx5ZQ6lemrg" + } + ] + } + }, + "response": [] + }, + { + "name": "Registration Get All (Openstack)", + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://10.212.171.74:8080/dashboards/v1/registrations?token=sk-7nitVmcWVrpvHYvcrmC0tTRjPvlb19wKBCynx5ZQ6lemrg", + "protocol": "http", + "host": [ + "10", + "212", + "171", + "74" + ], + "port": "8080", + "path": [ + "dashboards", + "v1", + "registrations" + ], + "query": [ + { + "key": "token", + "value": "sk-7nitVmcWVrpvHYvcrmC0tTRjPvlb19wKBCynx5ZQ6lemrg" + } + ] + } + }, + "response": [] + }, + { + "name": "Registration Get specific (Openstack)", + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://10.212.171.74:8080/dashboards/v1/registrations/XsdB3SfQMMT6zRQYbeuF?token=sk-7nitVmcWVrpvHYvcrmC0tTRjPvlb19wKBCynx5ZQ6lemrg", + "protocol": "http", + "host": [ + "10", + "212", + "171", + "74" + ], + "port": "8080", + "path": [ + "dashboards", + "v1", + "registrations", + "XsdB3SfQMMT6zRQYbeuF" + ], + "query": [ + { + "key": "token", + "value": "sk-7nitVmcWVrpvHYvcrmC0tTRjPvlb19wKBCynx5ZQ6lemrg" + } + ] + } + }, + "response": [] + }, + { + "name": "Registration Patch (Openstack)", + "request": { + "method": "PATCH", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"features\": {\r\n \"targetCurrencies\": [\"EUR\", \"SEK\", \"EUR\", \"USD\", \"JPY\"]\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://10.212.171.74:8080/dashboards/v1/registrations/XsdB3SfQMMT6zRQYbeuF?token=sk-7nitVmcWVrpvHYvcrmC0tTRjPvlb19wKBCynx5ZQ6lemrg", + "protocol": "http", + "host": [ + "10", + "212", + "171", + "74" + ], + "port": "8080", + "path": [ + "dashboards", + "v1", + "registrations", + "XsdB3SfQMMT6zRQYbeuF" + ], + "query": [ + { + "key": "token", + "value": "sk-7nitVmcWVrpvHYvcrmC0tTRjPvlb19wKBCynx5ZQ6lemrg" + } + ] + } + }, + "response": [] + }, + { + "name": "Registration Delete (Openstack)", + "request": { + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://10.212.171.74:8080/dashboards/v1/registrations/XsdB3SfQMMT6zRQYbeuF?token=sk-7nitVmcWVrpvHYvcrmC0tTRjPvlb19wKBCynx5ZQ6lemrg", + "protocol": "http", + "host": [ + "10", + "212", + "171", + "74" + ], + "port": "8080", + "path": [ + "dashboards", + "v1", + "registrations", + "XsdB3SfQMMT6zRQYbeuF" + ], + "query": [ + { + "key": "token", + "value": "sk-7nitVmcWVrpvHYvcrmC0tTRjPvlb19wKBCynx5ZQ6lemrg" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Dashboard", + "item": [ + { + "name": "Dashboard Get (Openstack)", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "http://10.212.171.74:8080/dashboards/v1/dashboard/XsdB3SfQMMT6zRQYbeuF?token=sk-7nitVmcWVrpvHYvcrmC0tTRjPvlb19wKBCynx5ZQ6lemrg", + "protocol": "http", + "host": [ + "10", + "212", + "171", + "74" + ], + "port": "8080", + "path": [ + "dashboards", + "v1", + "dashboard", + "XsdB3SfQMMT6zRQYbeuF" + ], + "query": [ + { + "key": "token", + "value": "sk-7nitVmcWVrpvHYvcrmC0tTRjPvlb19wKBCynx5ZQ6lemrg" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Notifications", + "item": [ + { + "name": "Notifications Get Specific (Openstack)", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "http://10.212.171.74:8080/dashboards/v1/notifications/D5rF04PkyCgY0dppjzAY?token=sk-7nitVmcWVrpvHYvcrmC0tTRjPvlb19wKBCynx5ZQ6lemrg", + "protocol": "http", + "host": [ + "10", + "212", + "171", + "74" + ], + "port": "8080", + "path": [ + "dashboards", + "v1", + "notifications", + "D5rF04PkyCgY0dppjzAY" + ], + "query": [ + { + "key": "token", + "value": "sk-7nitVmcWVrpvHYvcrmC0tTRjPvlb19wKBCynx5ZQ6lemrg" + } + ] + } + }, + "response": [] + }, + { + "name": "Notifications Delete (Openstack)", + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "http://10.212.171.74:8080/dashboards/v1/notifications/D5rF04PkyCgY0dppjzAY?token=sk-7nitVmcWVrpvHYvcrmC0tTRjPvlb19wKBCynx5ZQ6lemrg", + "protocol": "http", + "host": [ + "10", + "212", + "171", + "74" + ], + "port": "8080", + "path": [ + "dashboards", + "v1", + "notifications", + "D5rF04PkyCgY0dppjzAY" + ], + "query": [ + { + "key": "token", + "value": "sk-7nitVmcWVrpvHYvcrmC0tTRjPvlb19wKBCynx5ZQ6lemrg" + } + ] + } + }, + "response": [] + }, + { + "name": "Notifications Get All (Openstack)", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "http://10.212.171.74:8080/dashboards/v1/notifications?token=sk-7nitVmcWVrpvHYvcrmC0tTRjPvlb19wKBCynx5ZQ6lemrg", + "protocol": "http", + "host": [ + "10", + "212", + "171", + "74" + ], + "port": "8080", + "path": [ + "dashboards", + "v1", + "notifications" + ], + "query": [ + { + "key": "token", + "value": "sk-7nitVmcWVrpvHYvcrmC0tTRjPvlb19wKBCynx5ZQ6lemrg" + } + ] + } + }, + "response": [] + }, + { + "name": "Notifications Post (Openstack)", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"url\": \"webhook.com/\",\r\n \"country\": \"\",\r\n \"event\": [\"INVOKE\"]\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://10.212.171.74:8080/dashboards/v1/notifications?token=sk-7nitVmcWVrpvHYvcrmC0tTRjPvlb19wKBCynx5ZQ6lemrg", + "protocol": "http", + "host": [ + "10", + "212", + "171", + "74" + ], + "port": "8080", + "path": [ + "dashboards", + "v1", + "notifications" + ], + "query": [ + { + "key": "token", + "value": "sk-7nitVmcWVrpvHYvcrmC0tTRjPvlb19wKBCynx5ZQ6lemrg" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Status", + "item": [ + { + "name": "Status (Openstack)", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "http://10.212.171.74:8080/dashboards/v1/status?token=sk-owVa9zHyH5U23Kj5mhAStTRjPvitfmC4nAXWRutxOpVaUE", + "protocol": "http", + "host": [ + "10", + "212", + "171", + "74" + ], + "port": "8080", + "path": [ + "dashboards", + "v1", + "status" + ], + "query": [ + { + "key": "token", + "value": "sk-owVa9zHyH5U23Kj5mhAStTRjPvitfmC4nAXWRutxOpVaUE" + } + ] + } + }, + "response": [] + } + ] + } + ] +} \ No newline at end of file diff --git a/README.md b/README.md index 77851124c76999c9981cf3350768e219435d9e6e..579238b57daec4f6dcfb2e3eb5ab7f98116a65c1 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [](https://git.gvk.idi.ntnu.no/Nintendo_Alex/globeboard_cicd/-/commits/main) [](https://creativecommons.org/licenses/by-nc-nd/4.0/) -GlobeBoard Go REST API is a webapplication REST API service designed to provide GeoLocational Information. +GlobeBoard Go REST API is a REST API service designed to provide GeoLocational Information. ## Authors This code was developed by: @@ -17,16 +17,23 @@ This code was developed by: - User Registration through Firestore Auth - API Key Access -- GitLab CI/CD Integration +- GitLab CI/CD Testing and Deployment - Docker Compose Containerization - Discord Webhook Integration + + ## Tech Stack ### API Implementation - **Language:** Go ### Deployment + +Project is hosted on NTNU Openstack: [NTNU Openstack](http://10.212.171.74:8080/) + +Must be connected to NTNU Internal Network to access. + - **Platform:** OpenStack - **Containerization:** Docker Compose - **Description:** Services are containerized using Docker Compose to facilitate easy deployment and scaling. @@ -584,6 +591,29 @@ To run this project, you will need to add the following environment variables to `FIRESTORE_PROJECT_ID` - Project ID from Google Firebase that contains Firestore. +## Test in Postman (Against Hosted Site) + +- Clone the repository + +```bash + git clone git@git.gvk.idi.ntnu.no:course/prog2005/prog2005-2024-workspace/nintendo_alex/globeboard.git +``` + + - Navigate to the project directory: + + ```bash + cd globeboard + ``` + - Copy the Postman collection: + ```bash + cp ./GlobeBoard (Openstack).postman_collection.json ~ + ``` + - In Postman: + - Menu (Top Right) -> File -> Import. + - Select the copied file. + +NOTE: Must be connected to NTNU internal Network. + ## Run Locally - Clone the repository @@ -696,6 +726,12 @@ cd globeboard/Go/ ```bash docker compose down globeboard-test ``` + +## Roadmap + +- Implement more secure registration for users to the application. + - Actual authentication of users before registration. + - Implement check if user has authenticated before registration. ## Contributing