Skip to content

NoTIPswe/notip-management-api

Repository files navigation

NoTIP Management API

Servizio NestJS per la gestione tenant, utenti, gateway e configurazioni della piattaforma NoTIP.

Requisiti

  • Node.js e npm
  • un database configurato per l'applicazione
  • Keycloak raggiungibile, usato per autenticazione e impersonation
  • per gli smoke test: curl e jq

Avvio rapido

Installazione dipendenze:

npm install

Avvio in sviluppo:

npm run start:dev

Build produzione:

npm run build
npm run start:prod

Quality checks

Lint:

npm run lint:check

Type check:

npm run typecheck

Test unitari:

npm test

Test e2e:

npm run test:e2e

Endpoint utili

  • GET / verifica base del servizio
  • GET /auth/me ritorna il profilo autenticato
  • POST /auth/impersonate esegue token exchange per system_admin
  • GET /admin/tenants e POST /admin/tenants per gestione tenant
  • GET /admin/gateways e POST /admin/gateways per gestione gateway lato admin
  • GET /gateways per gateway del tenant corrente

Per una panoramica più ampia degli endpoint coperti lato integrazione, vedi lo script scripts/test/smoke-all-endpoints.sh.

Smoke test degli endpoint

Il repository include lo script scripts/test/smoke-all-endpoints.sh, utile per una validazione rapida end-to-end dell'API contro un ambiente locale o condiviso.

Cosa verifica:

  • autenticazione e GET /auth/me
  • amministrazione tenant e gateway
  • operazioni tenant su gateway, utenti, chiavi e soglie
  • alerts, audit log, costi, API clients e command endpoints
  • protezioni cross-tenant e blocchi in impersonation

Esecuzione:

bash scripts/test/smoke-all-endpoints.sh

Variabili supportate dallo script:

  • API_URL default http://localhost:3000
  • KC_URL default http://localhost:8080
  • REALM default notip
  • CLIENT_ID
  • CLIENT_SECRET
  • SYS_USER
  • SYS_PWD
  • CURL_TIMEOUT
  • CURL_CONNECT_TIMEOUT
  • RUN_ID

Esempio con override espliciti:

API_URL=http://localhost:3000 \
KC_URL=http://localhost:8080 \
CLIENT_ID=notip-mgmt-backend \
CLIENT_SECRET=your-secret \
bash scripts/test/smoke-all-endpoints.sh

Note operative:

  • lo script crea fixture temporanee per tenant, utenti e gateway
  • a fine esecuzione prova a fare cleanup delle risorse create
  • richiede un ambiente coerente con Keycloak configurato e raggiungibile
  • in caso di errore mostra lo status HTTP atteso/ricevuto e il body della risposta

OpenAPI

Per rigenerare la specifica OpenAPI:

npm run generate:openapi

Migrazioni

Generazione migration:

npm run migration:generate -- src/database/migrations/<nome-migration>

Esecuzione migration:

npm run migration:run

Rollback migration:

npm run migration:revert

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors