Skip to content

Admin endpointy (/admin)

Endpointy pro administraci systému — dashboard, notifikační typy, šablony a brandy. Vyžadují SuperAdmin (nebo AppAdmin pro dashboard).


Dashboard (/admin/dashboard)

GET /admin/dashboard/stats

Vrátí KPI statistiky.

http
GET /api/admin/dashboard/stats?days=7&topN=6
Authorization: Bearer <admin-token>

Auth:

  • SuperAdmin — vidí data za všechny aplikace
  • AppAdmin — vidí pouze data svých aplikací

Query parametry

ParametrVýchozíRozsahPopis
days71–90Počet dní pro statistiky
topN6≥1Počet top aplikací

Response

json
{
  "success": true,
  "data": {
    "totalUsers": 142,
    "activeUsers": 128,
    "totalNotificationsLast7Days": 1847,
    "topAppsByNotifications": [
      { "appCode": "crm", "appName": "CRM Systém", "count": 892 },
      { "appCode": "vallox-panel", "appName": "Vallox Panel", "count": 445 }
    ],
    "notificationsPerDay": [
      { "date": "2024-01-14", "count": 203 },
      { "date": "2024-01-15", "count": 287 },
      { "date": "2024-01-16", "count": 198 }
    ]
  }
}

Notifikační typy (/admin/notifications/types)

Správa typů notifikací (které typy existují, zda jsou povoleny email/push, zda je může uživatel vypnout).

GET /admin/notifications/types/:appCode

http
GET /api/admin/notifications/types/crm
Authorization: Bearer <superadmin-token>

Response

json
{
  "success": true,
  "data": [
    {
      "id": 1,
      "appCode": "crm",
      "code": "new_task",
      "name": "Nový úkol",
      "description": "Oznámení o přiřazení nového úkolu",
      "emailEnabled": true,
      "pushEnabled": true,
      "userCanDisable": true,
      "defaultEmail": true,
      "defaultPush": false,
      "createdAt": "2024-01-10T08:00:00.000Z"
    }
  ]
}

POST /admin/notifications/types/:appCode — vytvoření typu

http
POST /api/admin/notifications/types/crm
Authorization: Bearer <superadmin-token>
Content-Type: application/json
json
{
  "code": "deal_closed",
  "name": "Obchod uzavřen",
  "description": "Notifikace při uzavření obchodu",
  "emailEnabled": true,
  "pushEnabled": false,
  "userCanDisable": true,
  "defaultEmail": true,
  "defaultPush": false
}
PoleTypVýchozíPopis
codestringUnikátní kód typu
namestringZobrazovaný název
descriptionstringnullPopis
emailEnabledbooleantrueEmail notifikace povoleny
pushEnabledbooleanfalsePush notifikace povoleny
userCanDisablebooleantrueUživatel může typ vypnout
defaultEmailbooleantrueVýchozí stav email pro nové uživatele
defaultPushbooleanfalseVýchozí stav push pro nové uživatele

GET /admin/notifications/types/detail/:id

http
GET /api/admin/notifications/types/detail/1
Authorization: Bearer <superadmin-token>

PUT /admin/notifications/types/detail/:id

http
PUT /api/admin/notifications/types/detail/1
Authorization: Bearer <superadmin-token>
Content-Type: application/json
json
{
  "name": "Nový název",
  "emailEnabled": false
}

DELETE /admin/notifications/types/detail/:id

http
DELETE /api/admin/notifications/types/detail/1
Authorization: Bearer <superadmin-token>

Notifikační šablony — Admin (/admin/notifications/templates)

Totožné s /internal/notifications/templates, ale přístupné přes JWT + SuperAdmin místo API klíče.

GET /admin/notifications/templates/:appCode

http
GET /api/admin/notifications/templates/crm
Authorization: Bearer <superadmin-token>

POST /admin/notifications/templates/:appCode

http
POST /api/admin/notifications/templates/crm
Authorization: Bearer <superadmin-token>
Content-Type: application/json
json
{
  "type": "deal_closed",
  "locale": "cs",
  "subjectTemplate": "Obchod uzavřen: {{dealName}}",
  "bodyTemplate": "<h1>Obchod byl úspěšně uzavřen!</h1><p>{{dealName}} — {{dealValue}} Kč</p>",
  "description": "Česká šablona pro uzavření obchodu"
}

POST /admin/notifications/templates/preview — preview šablony

Vykreslí šablonu s testovacími daty pro náhled.

http
POST /api/admin/notifications/templates/preview
Authorization: Bearer <superadmin-token>
Content-Type: application/json
json
{
  "subjectTemplate": "Obchod uzavřen: {{dealName}}",
  "bodyTemplate": "<h1>Uzavřeno!</h1><p>{{dealName}} — {{dealValue}} Kč</p>",
  "data": {
    "dealName": "Projekt Omega",
    "dealValue": "250000"
  },
  "brand": "atrea"
}

Response

json
{
  "success": true,
  "data": {
    "subject": "Obchod uzavřen: Projekt Omega",
    "htmlBody": "<h1>Uzavřeno!</h1><p>Projekt Omega — 250000 Kč</p>"
  }
}

GET /admin/notifications/log/:appCode — log notifikací

http
GET /api/admin/notifications/log/crm
Authorization: Bearer <superadmin-token>

Brandy (/admin/brands)

Správa brandů (vizuální identita pro emaily a aplikace).

GET /admin/brands — seznam brandů

http
GET /api/admin/brands
Authorization: Bearer <superadmin-token>

Response

json
{
  "success": true,
  "data": [
    {
      "id": 1,
      "slug": "atrea",
      "name": "Atrea",
      "primaryColor": "#1976D2",
      "primaryDark": "#1565C0",
      "background": "#FFFFFF",
      "fontColor": "#212121",
      "linkColor": "#1976D2",
      "logoUrl": "/assets/img/atrea/logo.svg",
      "footerText": "© Atrea s.r.o.",
      "emailFrom": "noreply@atrea.eu",
      "isDefault": true
    }
  ]
}

GET /admin/brands/themes — slug → theme mapa

Vrátí brandy jako mapu pro frontend theming.

http
GET /api/admin/brands/themes
Authorization: Bearer <superadmin-token>

Response

json
{
  "success": true,
  "data": {
    "atrea": {
      "primaryColor": "#1976D2",
      "primaryDark": "#1565C0",
      "background": "#FFFFFF",
      "fontColor": "#212121",
      "linkColor": "#1976D2",
      "logoUrl": "/assets/img/atrea/logo.svg"
    },
    "vallox": { ... }
  }
}

POST /admin/brands — vytvoření brandu

http
POST /api/admin/brands
Authorization: Bearer <superadmin-token>
Content-Type: application/json
json
{
  "slug": "nova-znacka",
  "name": "Nová Značka",
  "primaryColor": "#E91E63",
  "primaryDark": "#C2185B",
  "background": "#FFFFFF",
  "fontColor": "#212121",
  "linkColor": "#E91E63",
  "logoUrl": "/assets/img/nova-znacka/logo.svg",
  "footerText": "© Nová Značka s.r.o.",
  "emailFrom": "noreply@nova-znacka.cz",
  "isDefault": false
}

PUT /admin/brands/:id — aktualizace brandu

http
PUT /api/admin/brands/3
Authorization: Bearer <superadmin-token>
Content-Type: application/json
json
{
  "primaryColor": "#F44336",
  "emailFrom": "info@nova-znacka.cz"
}

DELETE /admin/brands/:id — smazání brandu

http
DELETE /api/admin/brands/3
Authorization: Bearer <superadmin-token>

DANGER

Výchozí brand nelze smazat. Nejdřív nastavte jiný brand jako výchozí.

POST /admin/brands/:id/default — nastavení výchozího brandu

http
POST /api/admin/brands/3/default
Authorization: Bearer <superadmin-token>

Nastaví brand jako výchozí a odebere výchozí status ostatním brandům.


Zitadel Admin (/zitadel/admin)

Správa Zitadel organizací (vyžaduje SuperAdmin + platný Zitadel service account token).

GET /zitadel/admin/orgs

http
GET /api/zitadel/admin/orgs
Authorization: Bearer <superadmin-token>

POST /zitadel/admin/orgs — vytvoření organizace

http
POST /api/zitadel/admin/orgs
Authorization: Bearer <superadmin-token>
Content-Type: application/json
json
{
  "name": "Nová Firma s.r.o.",
  "domain": "nova-firma.cz"
}

PUT /zitadel/admin/orgs/:orgId/branding — nastavení brandingu

http
PUT /api/zitadel/admin/orgs/org_abc123/branding
Authorization: Bearer <superadmin-token>
Content-Type: application/json
json
{
  "primaryColor": "#E91E63",
  "logoUrl": "https://cdn.atrea.eu/logos/nova-firma.png"
}

POST /zitadel/admin/orgs/:orgId/setup — kompletní brand setup

Automaticky vytvoří projekt, OIDC aplikaci a nakonfiguruje redirect URI v Zitadelu.

http
POST /api/zitadel/admin/orgs/org_abc123/setup
Authorization: Bearer <superadmin-token>
Content-Type: application/json
json
{
  "projectName": "Nova Firma Portal",
  "appName": "Portal App",
  "redirectUris": ["https://portal.nova-firma.cz/callback"],
  "postLogoutUris": ["https://portal.nova-firma.cz/logout"],
  "userApiAppCode": "portal"
}

Atrea User API — interní dokumentace