diff --git a/.gitignore b/.gitignore index f052f41..c4e2458 100644 --- a/.gitignore +++ b/.gitignore @@ -26,8 +26,6 @@ vendor/ volumes/node-red/ main -*.sh - **/*.log ROADMAP.md diff --git a/cmd/server/main.go b/cmd/server/main.go index 62e1169..d0aec8a 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -26,6 +26,7 @@ import ( "github.com/gorilla/handlers" "github.com/gorilla/mux" "github.com/gorilla/websocket" + "gorm.io/gorm" ) var upgrader = websocket.Upgrader{ @@ -108,7 +109,7 @@ func main() { r.HandleFunc("/reslevis/removeTracker/{id}", controller.TrackerDelete(db, writer, ctx)).Methods("DELETE") r.HandleFunc("/reslevis/updateTracker", controller.TrackerUpdate(db)).Methods("PUT") - wsHandler := http.HandlerFunc(serveWs(appState, ctx)) + wsHandler := http.HandlerFunc(serveWs(db, ctx)) restApiHandler := handlers.CORS(originsOk, headersOk, methodsOk)(r) mainHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if strings.HasPrefix(r.URL.Path, "/api/beacons/ws") { @@ -166,7 +167,7 @@ eventLoop: logFile.Close() } -func serveWs(appstate *appcontext.AppState, ctx context.Context) http.HandlerFunc { +func serveWs(db *gorm.DB, ctx context.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { ws, err := upgrader.Upgrade(w, r, nil) if err != nil { @@ -177,12 +178,12 @@ func serveWs(appstate *appcontext.AppState, ctx context.Context) http.HandlerFun return } wg.Add(2) - go writer(ws, appstate, ctx) + go writer(ws, db, ctx) go reader(ws, ctx) } } -func writer(ws *websocket.Conn, appstate *appcontext.AppState, ctx context.Context) { +func writer(ws *websocket.Conn, db *gorm.DB, ctx context.Context) { pingTicker := time.NewTicker((60 * 9) / 10 * time.Second) beaconTicker := time.NewTicker(2 * time.Second) defer func() { @@ -199,8 +200,9 @@ func writer(ws *websocket.Conn, appstate *appcontext.AppState, ctx context.Conte ws.WriteMessage(websocket.CloseMessage, websocket.FormatCloseMessage(websocket.CloseNormalClosure, "")) return case <-beaconTicker.C: - beacons := appstate.GetAllHttpResults() - js, err := json.Marshal(beacons) + var list []model.Tracker + db.Find(&list) + js, err := json.Marshal(list) if err != nil { js = []byte("error") } diff --git a/internal/pkg/model/parser.go b/internal/pkg/model/parser.go index b5d78b9..e118e4a 100644 --- a/internal/pkg/model/parser.go +++ b/internal/pkg/model/parser.go @@ -55,8 +55,6 @@ func (p *ParserRegistry) Register(name string, c Config) { configs: c.Configs, } - fmt.Printf("registered beacon parser: %+v\n", b) - p.ParserList = append(p.ParserList, b) } diff --git a/scripts/api.sh b/scripts/api.sh new file mode 100644 index 0000000..ad27641 --- /dev/null +++ b/scripts/api.sh @@ -0,0 +1,246 @@ +BASE_URL="http://localhost:1902" + +echo "==========================================" +echo "GATEWAY API TESTS" +echo "==========================================" + +echo "1. Listing all Gateways" +LIST=$(curl -s -X GET "$BASE_URL/reslevis/getGateways" | jq -c '.[]') +GATEWAY_IDS=() + +IFS=$'\n' +for r in $LIST +do + echo "$r" + GATEWAY_IDS+=($(echo "$r" | jq -r '.id')) +done + +sleep 1 + +if [ ${#GATEWAY_IDS[@]} -gt 1 ]; then + echo -e "\n\n2. Updating Gateway ${GATEWAY_IDS[1]}" + curl -X PUT "$BASE_URL/reslevis/updateGateway/${GATEWAY_IDS[1]}" \ + -H "Content-Type: application/json" \ + -d "{ + \"id\": \"${GATEWAY_IDS[1]}\", + \"name\": \"GU-100-Updated\", + \"mac\": \"AA:BB:CC:DD:EE:FF\", + \"status\": \"online\", + \"model\": \"MG3\", + \"ip\": \"127.0.0.1\", + \"position\": \"unknown\", + \"x\": 1, + \"y\": 1, + \"notes\": \"some description\", + \"floor\": \"second\", + \"building\": \"hospital\" + }" + + sleep 1 + + echo -e "\n\n3. Listing Gateways after update" + LIST=$(curl -s -X GET "$BASE_URL/reslevis/getGateways" | jq -c '.[]') + + IFS=$'\n' + for r in $LIST + do + echo "$r" + done + + sleep 1 + + echo -e "\n\n4. Deleting Gateway ${GATEWAY_IDS[1]}" + curl -X DELETE "$BASE_URL/reslevis/removeGateway/${GATEWAY_IDS[1]}" + + sleep 1 + + echo -e "\n\n5. Verifying Delete (List again)..." + LIST=$(curl -s -X GET "$BASE_URL/reslevis/getGateways" | jq -c '.[]') + + IFS=$'\n' + for r in $LIST + do + echo "$r" + done +else + echo "Not enough gateways to test update/delete" +fi + + +echo -e "\n\n==========================================" +echo "ZONE API TESTS" +echo "==========================================" + +echo "6. Listing all Zones" +LIST=$(curl -s -X GET "$BASE_URL/reslevis/getZones" | jq -c '.[]') +ZONE_IDS=() + +IFS=$'\n' +for r in $LIST +do + echo "$r" + ZONE_IDS+=($(echo "$r" | jq -r '.id')) +done + +sleep 1 + +if [ ${#ZONE_IDS[@]} -gt 0 ]; then + echo -e "\n\n7. Updating Zone ${ZONE_IDS[0]}" + curl -X PUT "$BASE_URL/reslevis/updateZone" \ + -H "Content-Type: application/json" \ + -d "{ + \"id\": \"${ZONE_IDS[0]}\", + \"name\": \"Zone-Updated\", + \"groups\": [\"security\", \"logistics\"] + }" + + sleep 1 + + echo -e "\n\n8. Listing Zones after update" + LIST=$(curl -s -X GET "$BASE_URL/reslevis/getZones" | jq -c '.[]') + + IFS=$'\n' + for r in $LIST + do + echo "$r" + done + + sleep 1 + + echo -e "\n\n9. Deleting Zone ${ZONE_IDS[0]}" + curl -X DELETE "$BASE_URL/reslevis/removeZone/${ZONE_IDS[0]}" + + sleep 1 + + echo -e "\n\n10. Verifying Delete (List again)..." + LIST=$(curl -s -X GET "$BASE_URL/reslevis/getZones" | jq -c '.[]') + + IFS=$'\n' + for r in $LIST + do + echo "$r" + done +else + echo "No zones to test update/delete" +fi + + +echo -e "\n\n==========================================" +echo "TRACKERZONE API TESTS" +echo "==========================================" + +echo "11. Listing all TrackerZones" +LIST=$(curl -s -X GET "$BASE_URL/reslevis/getTrackerZones" | jq -c '.[]') +TRACKERZONE_IDS=() + +IFS=$'\n' +for r in $LIST +do + echo "$r" + TRACKERZONE_IDS+=($(echo "$r" | jq -r '.id')) +done + +sleep 1 + +if [ ${#TRACKERZONE_IDS[@]} -gt 0 ]; then + echo -e "\n\n12. Updating TrackerZone ${TRACKERZONE_IDS[0]}" + curl -X PUT "$BASE_URL/reslevis/updateTrackerZone" \ + -H "Content-Type: application/json" \ + -d "{ + \"id\": \"${TRACKERZONE_IDS[0]}\", + \"name\": \"TrackerZone-Updated\" + }" + + sleep 1 + + echo -e "\n\n13. Listing TrackerZones after update" + LIST=$(curl -s -X GET "$BASE_URL/reslevis/getTrackerZones" | jq -c '.[]') + + IFS=$'\n' + for r in $LIST + do + echo "$r" + done + + sleep 1 + + echo -e "\n\n14. Deleting TrackerZone ${TRACKERZONE_IDS[0]}" + curl -X DELETE "$BASE_URL/reslevis/removeTrackerZone/${TRACKERZONE_IDS[0]}" + + sleep 1 + + echo -e "\n\n15. Verifying Delete (List again)..." + LIST=$(curl -s -X GET "$BASE_URL/reslevis/getTrackerZones" | jq -c '.[]') + + IFS=$'\n' + for r in $LIST + do + echo "$r" + done +else + echo "No trackerzones to test update/delete" +fi + + +echo -e "\n\n==========================================" +echo "TRACKER API TESTS" +echo "==========================================" + +echo "16. Listing all Trackers" +LIST=$(curl -s -X GET "$BASE_URL/reslevis/getTrackers" | jq -c '.[]') +TRACKER_IDS=() + +IFS=$'\n' +for r in $LIST +do + echo "$r" + TRACKER_IDS+=($(echo "$r" | jq -r '.id')) +done + +sleep 1 + +if [ ${#TRACKER_IDS[@]} -gt 0 ]; then + echo -e "\n\n17. Updating Tracker ${TRACKER_IDS[0]}" + curl -X PUT "$BASE_URL/reslevis/updateTracker" \ + -H "Content-Type: application/json" \ + -d "{ + \"id\": \"${TRACKER_IDS[0]}\", + \"name\": \"Tracker-Updated\", + \"battery\": 85, + \"status\": \"inactive\" + }" + + sleep 1 + + echo -e "\n\n18. Listing Trackers after update" + LIST=$(curl -s -X GET "$BASE_URL/reslevis/getTrackers" | jq -c '.[]') + + IFS=$'\n' + for r in $LIST + do + echo "$r" + done + + sleep 1 + + echo -e "\n\n19. Deleting Tracker ${TRACKER_IDS[0]}" + curl -X DELETE "$BASE_URL/reslevis/removeTracker/${TRACKER_IDS[0]}" + + sleep 1 + + echo -e "\n\n20. Verifying Delete (List again)..." + LIST=$(curl -s -X GET "$BASE_URL/reslevis/getTrackers" | jq -c '.[]') + + IFS=$'\n' + for r in $LIST + do + echo "$r" + done +else + echo "No trackers to test update/delete" +fi + + +echo -e "\n\n==========================================" +echo "ALL TESTS COMPLETED" +echo "==========================================" \ No newline at end of file diff --git a/scripts/gatewayApi.sh b/scripts/gatewayApi.sh new file mode 100755 index 0000000..451f83f --- /dev/null +++ b/scripts/gatewayApi.sh @@ -0,0 +1,46 @@ +#!/bin/bash +BASE_URL="http://localhost:1902" # Change to your port + +echo "1. Adding a Gateway..." +curl -X POST "$BASE_URL/reslevis/postGateway" \ + -H "Content-Type: application/json" \ + -d '{ + "id": "gw_01", + "name": "Front Entrance", + "mac": "AA:BB:CC:DD:EE:FF", + "status": "online", + "building": "Main HQ" + }' + +sleep 1 + +echo -e "\n\n2. Listing Gateways..." +curl -X GET "$BASE_URL/reslevis/getGateways" + +sleep 1 + +echo -e "\n\n2. Updating Gateway..." +curl -X PUT "$BASE_URL/reslevis/updateGateway/gw_01" \ + -H "Content-Type: application/json" \ + -d '{ + "id": "gw_01", + "name": "Front Entrance", + "mac": "AA:BB:CC:DD:EE:FF", + "status": "online", + "building": "Pisarna HQ" + }' + +sleep 1 + +echo -e "\n\n2. Listing Gateways..." +curl -X GET "$BASE_URL/reslevis/getGateways" + +sleep 1 + +echo -e "\n\n3. Deleting Gateway..." +curl -X DELETE "$BASE_URL/reslevis/removeGateway/gw_01" + +sleep 1 + +echo -e "\n\n4. Verifying Delete (List again)..." +curl -X GET "$BASE_URL/reslevis/getGateways" \ No newline at end of file diff --git a/scripts/testalltrackers.sh b/scripts/testalltrackers.sh new file mode 100755 index 0000000..331e1fb --- /dev/null +++ b/scripts/testalltrackers.sh @@ -0,0 +1,248 @@ +#!/bin/bash +BASE_URL="http://localhost:1902" + +echo "Adding all trackers individually..." + +echo "1. Adding tracker C83F8F17DB35..." +curl -s -X POST "$BASE_URL/reslevis/postTracker" \ + -H "Content-Type: application/json" \ + -d '{ + "id": "a3c1b2e4-9f73-4c1f-8c87-52e4d9cf9a01", + "name": "INGICS-TASTO", + "mac": "C83F8F17DB35", + "status": "1", + "model": "MNBT01G", + "position": "", + "notes": "", + "x": 0, + "y": 0, + "floor": null, + "building": null + }' +echo -e "\n" + +sleep 1 + +echo "2. Adding tracker C300003947DF..." +curl -s -X POST "$BASE_URL/reslevis/postTracker" \ + -H "Content-Type: application/json" \ + -d '{ + "id": "d91a7b4f-02f6-44b6-9fa0-ff6df1c2e7b3", + "name": "RUSSI", + "mac": "C300003947DF", + "status": "1", + "model": "B7", + "position": "", + "notes": "", + "x": 0, + "y": 0, + "floor": null, + "building": null + }' +echo -e "\n" + +sleep 1 + +echo "3. Adding tracker C300003B1E20..." +curl -s -X POST "$BASE_URL/reslevis/postTracker" \ + -H "Content-Type: application/json" \ + -d '{ + "id": "5f1a9c3d-4b6f-4f88-9c92-df5c2d37c2aa", + "name": "PETRELLA", + "mac": "C300003B1E20", + "status": "1", + "model": "MWC01", + "position": "", + "notes": "", + "x": 0, + "y": 0, + "floor": null, + "building": null + }' +echo -e "\n" + +sleep 1 + +echo "4. Adding tracker C300003946B5..." +curl -s -X POST "$BASE_URL/reslevis/postTracker" \ + -H "Content-Type: application/json" \ + -d '{ + "id": "8b7d42e9-4db5-4f42-a6c1-4e9f0c3e7d12", + "name": "AMOROSA-S", + "mac": "C300003946B5", + "status": "1", + "model": "MWB01", + "position": "", + "notes": "", + "x": 0, + "y": 0, + "floor": null, + "building": null + }' +echo -e "\n" + +sleep 1 + +echo "5. Adding tracker C300003946AC..." +curl -s -X POST "$BASE_URL/reslevis/postTracker" \ + -H "Content-Type: application/json" \ + -d '{ + "id": "1e93b3fd-7d67-4a53-9c7a-0f0a8e7e41c6", + "name": "GALLO", + "mac": "C300003946AC", + "status": "1", + "model": "MWB01", + "position": "", + "notes": "", + "x": 0, + "y": 0, + "floor": null, + "building": null + }' +echo -e "\n" + +sleep 1 + +echo "6. Adding tracker C300003946B1..." +curl -s -X POST "$BASE_URL/reslevis/postTracker" \ + -H "Content-Type: application/json" \ + -d '{ + "id": "e2b9d6cc-7d89-46bb-9e45-2b7f71e4a4d0", + "name": "SMISEK", + "mac": "C300003946B1", + "status": "1", + "model": "MWB01", + "position": "", + "notes": "", + "x": 0, + "y": 0, + "floor": null, + "building": null + }' +echo -e "\n" + +sleep 1 + +echo "7. Adding tracker C300003B1E21..." +curl -s -X POST "$BASE_URL/reslevis/postTracker" \ + -H "Content-Type: application/json" \ + -d '{ + "id": "6cfdeab2-03c4-41d7-9c1d-5f7bcb8c0b6b", + "name": "ROMAGNUOLO", + "mac": "C300003B1E21", + "status": "1", + "model": "MWC01", + "position": "", + "notes": "", + "x": 0, + "y": 0, + "floor": null, + "building": null + }' +echo -e "\n" + +sleep 1 + +echo "8. Adding tracker C300003947C4..." +curl -s -X POST "$BASE_URL/reslevis/postTracker" \ + -H "Content-Type: application/json" \ + -d '{ + "id": "fa73b6dd-9941-4d25-8a9a-8df3b09a9d77", + "name": "BC-43", + "mac": "C300003947C4", + "status": "1", + "model": "B7", + "position": "", + "notes": "", + "x": 0, + "y": 0, + "floor": null, + "building": null + }' +echo -e "\n" + +sleep 1 + +echo "9. Adding tracker C300003947E2..." +curl -s -X POST "$BASE_URL/reslevis/postTracker" \ + -H "Content-Type: application/json" \ + -d '{ + "id": "9c55d03e-2db1-4b0a-b1ac-8b60f60e712d", + "name": "AMOROSA-F", + "mac": "C300003947E2", + "status": "1", + "model": "B7", + "position": "", + "notes": "", + "x": 0, + "y": 0, + "floor": null, + "building": null + }' +echo -e "\n" + +sleep 1 + +echo "10. Adding tracker C300003B1E1F..." +curl -s -X POST "$BASE_URL/reslevis/postTracker" \ + -H "Content-Type: application/json" \ + -d '{ + "id": "2a00e3b4-4a12-4f70-a4c4-408a1779e251", + "name": "DINONNO", + "mac": "C300003B1E1F", + "status": "1", + "model": "MWC01", + "position": "", + "notes": "", + "x": 0, + "y": 0, + "floor": null, + "building": null + }' +echo -e "\n" + +sleep 1 + +echo "11. Adding tracker C7AE561E38B7..." +curl -s -X POST "$BASE_URL/reslevis/postTracker" \ + -H "Content-Type: application/json" \ + -d '{ + "id": "bf6d6c84-5e1a-4b83-a10f-0e9cf2a198c3", + "name": "ismarch-X6", + "mac": "C7AE561E38B7", + "status": "1", + "model": "B7", + "position": "", + "notes": "", + "x": 0, + "y": 0, + "floor": null, + "building": null + }' +echo -e "\n" + +sleep 1 + +echo "12. Adding tracker E01F9A7A47D2..." +curl -s -X POST "$BASE_URL/reslevis/postTracker" \ + -H "Content-Type: application/json" \ + -d '{ + "id": "41c4c6b2-9c3d-48d6-aea6-7c1bcfdfb2b7", + "name": "ismarch-C2", + "mac": "E01F9A7A47D2", + "status": "1", + "model": "B7", + "position": "", + "notes": "", + "x": 0, + "y": 0, + "floor": null, + "building": null + }' +echo -e "\n" + +sleep 1 + +echo "All trackers added! Listing all trackers..." +curl -X GET "$BASE_URL/reslevis/getTrackers" +echo -e "\n" \ No newline at end of file diff --git a/scripts/token.sh b/scripts/token.sh new file mode 100755 index 0000000..bfdd3a4 --- /dev/null +++ b/scripts/token.sh @@ -0,0 +1,15 @@ +TOKEN=$( + curl -k -s -X POST "https://10.251.0.30:10002/realms/API.Server.local/protocol/openid-connect/token" \ + -H "Content-Type: application/x-www-form-urlencoded" \ + -d "grant_type=password" \ + -d "client_id=Fastapi" \ + -d "client_secret=wojuoB7Z5xhlPFrF2lIxJSSdVHCApEgC" \ + -d "username=core" \ + -d "password=C0r3_us3r_Cr3d3nt14ls" \ + -d "audience=Fastapi" \ + | jq -r '.access_token' +) + +curl -k -s -X GET "https://10.251.0.30:5050/reslevis/getTrackers" \ + -H "accept: application/json" \ + -H "Authorization: Bearer ${TOKEN}" \ No newline at end of file diff --git a/scripts/trackerApi.sh b/scripts/trackerApi.sh new file mode 100755 index 0000000..9f19cca --- /dev/null +++ b/scripts/trackerApi.sh @@ -0,0 +1,58 @@ +#!/bin/bash +BASE_URL="http://localhost:1902" # Change to your port + +echo "1. Adding a Tracker..." +curl -X POST "$BASE_URL/reslevis/postTracker" \ + -H "Content-Type: application/json" \ + -d '{ + "id": "tracker_01", + "name": "Employee Badge #001", + "mac": "11:22:33:44:55:66", + "status": "active", + "model": "BLE Beacon v2", + "position": "Office A-101", + "notes": "Primary employee tracker", + "x": 150, + "y": 200, + "floor": "550e8400-e29b-41d4-a716-446655440000", + "building": "550e8400-e29b-41d4-a716-446655440001" + }' + +sleep 1 + +echo -e "\n\n2. Listing Trackers..." +curl -X GET "$BASE_URL/reslevis/getTrackers" + +sleep 1 + +echo -e "\n\n3. Updating Tracker..." +curl -X PUT "$BASE_URL/reslevis/updateTracker" \ + -H "Content-Type: application/json" \ + -d '{ + "id": "tracker_01", + "name": "Employee Badge #001 - Updated", + "mac": "11:22:33:44:55:66", + "status": "inactive", + "model": "BLE Beacon v2", + "position": "Office B-205", + "notes": "Updated position and status", + "x": 300, + "y": 400, + "floor": "550e8400-e29b-41d4-a716-446655440002", + "building": "550e8400-e29b-41d4-a716-446655440001" + }' + +sleep 1 + +echo -e "\n\n4. Listing Trackers after update..." +curl -X GET "$BASE_URL/reslevis/getTrackers" + +sleep 1 + +echo -e "\n\n5. Deleting Tracker..." +curl -X DELETE "$BASE_URL/reslevis/removeTracker/tracker_01" + +sleep 1 + +echo -e "\n\n6. Verifying Delete (List again)..." +curl -X GET "$BASE_URL/reslevis/getTrackers" \ No newline at end of file diff --git a/scripts/trackerzonesApi.sh b/scripts/trackerzonesApi.sh new file mode 100755 index 0000000..b8c6f7c --- /dev/null +++ b/scripts/trackerzonesApi.sh @@ -0,0 +1,46 @@ +#!/bin/bash +BASE_URL="http://localhost:1902" + +echo "1. Adding Tracker Zone Mapping..." +curl -X POST "$BASE_URL/reslevis/postTrackerZone" \ +-H "Content-Type: application/json" \ +-d '{ + "id": "b6b2a2e4-58b3-4aa4-8d6a-4b55a2c5b2d2", + "zoneList": ["0c7b9c7f-6d0f-4d4e-9e4a-2c9f2b1d6a11","1d2e3f40-1111-2222-3333-444455556666"], + "tracker": "1e93b3fd-7d67-4a53-9c7a-0f0a8e7e41c6", + "days": "All,Mon,Tue,Wed,Thu,Fri", + "time": "09:00-17:00" +}' + +sleep 1 + +echo -e "\n\n2. Listing Trackers..." +curl -X GET "$BASE_URL/reslevis/getTrackerZones" + +# sleep 1 + +# echo "Updating Tracker Zone List and Time..." +# curl -X PUT "$BASE_URL/reslevis/updateTrackerZone" \ +# -H "Content-Type: application/json" \ +# -d '{ +# "id": "tz_001", +# "zoneList": ["zone_C"], +# "tracker": "TAG_55", +# "days": "Sat-Sun", +# "time": "10:00-14:00" +# }' + +# sleep 1 + +# echo -e "\n\n2. Listing Trackers..." +# curl -X GET "$BASE_URL/reslevis/getTrackerZones" + +# sleep 1 + +# echo -e "\n\n3. Deleting Tracker Mapping..." +# curl -X DELETE "$BASE_URL/reslevis/removeTrackerZone/tz_001" + +# sleep 1 + +# echo -e "\n\n2. Listing Trackers..." +# curl -X GET "$BASE_URL/reslevis/getTrackerZones" \ No newline at end of file diff --git a/scripts/zonesApi.sh b/scripts/zonesApi.sh new file mode 100755 index 0000000..3aefb81 --- /dev/null +++ b/scripts/zonesApi.sh @@ -0,0 +1,44 @@ +#!/bin/bash +BASE_URL="http://localhost:1902" + +echo "1. Adding a Zone with Groups (JSON Array)..." +curl -X POST "$BASE_URL/reslevis/postZone" \ +-H "Content-Type: application/json" \ +-d '{ + "id": "zone_A", + "name": "Warehouse North", + "groups": ["security", "logistics", "staff"], + "floor": "1", + "building": "B1" +}' + +sleep 1 + +echo -e "\n\n2. Listing Zones (Check if groups are restored as slice)..." +curl -X GET "$BASE_URL/reslevis/getZones" + +sleep 1 + +echo -e "\n\n3. Updating Zone (Adding a group)..." +curl -X PUT "$BASE_URL/reslevis/updateZone" \ +-H "Content-Type: application/json" \ +-d '{ + "id": "Zone_A", + "name": "Warehouse North Updated", + "groups": ["security", "logistics", "staff", "admin"] +}' + +sleep 1 + +echo -e "\n\n2. Listing Zones (Check if groups are restored as slice)..." +curl -X GET "$BASE_URL/reslevis/getZones" + +sleep 1 + +echo -e "\n\n4. Deleting Zone..." +curl -X DELETE "$BASE_URL/reslevis/removeZone/zone_A" + +sleep 1 + +echo -e "\n\n2. Listing Zones (Check if groups are restored as slice)..." +curl -X GET "$BASE_URL/reslevis/getZones" \ No newline at end of file