Tmavý režim
Profil (/profile)
Správa uživatelského profilu, per-aplikačních preferencí, notifikačních preferencí a Web Push subscripcí.
Lazy vytváření
Profil a preference se vytvářejí automaticky při prvním přístupu — není potřeba žádná explicitní inicializace.
GET /profile/me — vlastní profil
Vrátí globální profil přihlášeného uživatele. Pokud profil neexistuje, vytvoří se automaticky.
http
GET /api/profile/me
Authorization: Bearer <token>Response
json
{
"success": true,
"data": {
"id": 42,
"email": "jan.novak@firma.cz",
"displayName": "Jan Novák",
"avatarUrl": "https://example.com/avatar.jpg",
"locale": "cs",
"theme": "light",
"brand": "atrea",
"createdAt": "2024-01-15T10:00:00.000Z",
"updatedAt": "2024-01-20T14:30:00.000Z"
}
}| Pole | Hodnoty | Výchozí |
|---|---|---|
locale | "cs", "en", ... | "cs" |
theme | "light", "dark", "system" | "light" |
brand | slug brandu (např. "atrea", "vallox") | "atrea" |
PUT /profile/me — aktualizace profilu
http
PUT /api/profile/me
Authorization: Bearer <token>
Content-Type: application/jsonRequest body
json
{
"displayName": "Jan Novák",
"avatarUrl": "https://example.com/avatar.jpg",
"locale": "cs",
"theme": "dark",
"brand": "vallox"
}Všechna pole jsou volitelná — aktualizují se pouze ta, která pošlete.
GET /profile/me/admin-status — admin status
Zjistí, zda je přihlášený uživatel superadmin.
http
GET /api/profile/me/admin-status
Authorization: Bearer <token>Response
json
{
"success": true,
"data": {
"email": "jan.novak@firma.cz",
"isSuperAdmin": false
}
}GET /profile/me/apps — všechny per-app preference
http
GET /api/profile/me/apps
Authorization: Bearer <token>Response
json
{
"success": true,
"data": [
{
"applicationCode": "crm",
"showHelp": true,
"notificationsEnabled": true
},
{
"applicationCode": "vallox-panel",
"showHelp": false,
"notificationsEnabled": false
}
]
}GET /profile/me/apps/:appCode — per-app preference
Vrátí preference pro konkrétní aplikaci. Pokud preference neexistují, vytvoří se s výchozími hodnotami.
http
GET /api/profile/me/apps/crm
Authorization: Bearer <token>Response
json
{
"success": true,
"data": {
"applicationCode": "crm",
"showHelp": true,
"notificationsEnabled": true
}
}PUT /profile/me/apps/:appCode — aktualizace per-app preference
http
PUT /api/profile/me/apps/crm
Authorization: Bearer <token>
Content-Type: application/jsonRequest body
json
{
"showHelp": false,
"notificationsEnabled": true
}| Pole | Typ | Popis |
|---|---|---|
showHelp | boolean | Zobrazovat nápovědu v UI |
notificationsEnabled | boolean | Globální přepínač notifikací pro tuto aplikaci |
GET /profile/:email — profil jiného uživatele (admin)
http
GET /api/profile/jan.novak@firma.cz
Authorization: Bearer <admin-token>Auth: JWT + AppAdmin nebo SuperAdmin
Notifikační preference
GET /profile/me/notifications/:appCode
Vrátí per-type notifikační preference pro aplikaci.
http
GET /api/profile/me/notifications/crm
Authorization: Bearer <token>Response
json
{
"success": true,
"data": [
{
"notificationTypeId": 1,
"code": "new_task",
"name": "Nový úkol",
"userCanDisable": true,
"email": true,
"push": false,
"defaultEmail": true,
"defaultPush": false
}
]
}PUT /profile/me/notifications/preferences/bulk — bulk update
http
PUT /api/profile/me/notifications/preferences/bulk
Authorization: Bearer <token>
Content-Type: application/jsonjson
{
"updates": [
{ "notificationTypeId": 1, "email": true, "push": true },
{ "notificationTypeId": 2, "email": false }
]
}PUT /profile/me/notifications/preferences/:notificationTypeId — jeden typ
http
PUT /api/profile/me/notifications/preferences/1
Authorization: Bearer <token>
Content-Type: application/jsonjson
{
"email": true,
"push": false
}WARNING
Uživatel může měnit preference pouze pro typy, kde userCanDisable = true. Pro ostatní typy vrátí API chybu 403.
Web Push subscripce
GET /profile/me/push/vapid-key — VAPID public key
Vrátí VAPID public key pro inicializaci Web Push v prohlížeči.
http
GET /api/profile/me/push/vapid-key
Authorization: Bearer <token>Response
json
{
"success": true,
"data": {
"vapidPublicKey": "BM8U3B..."
}
}POST /profile/me/push/subscribe — registrace subscripce
http
POST /api/profile/me/push/subscribe
Authorization: Bearer <token>
Content-Type: application/jsonjson
{
"subscription": {
"endpoint": "https://fcm.googleapis.com/fcm/send/...",
"keys": {
"p256dh": "BMutZ...",
"auth": "Kd9..."
}
},
"deviceLabel": "Můj notebook Chrome"
}POST /profile/me/push/unsubscribe — odregistrování
http
POST /api/profile/me/push/unsubscribe
Authorization: Bearer <token>
Content-Type: application/jsonjson
{
"endpoint": "https://fcm.googleapis.com/fcm/send/..."
}GET /profile/me/push/subscriptions — seznam subscripcí
http
GET /api/profile/me/push/subscriptions
Authorization: Bearer <token>Response
json
{
"success": true,
"data": [
{
"id": 12,
"endpoint": "https://fcm.googleapis.com/fcm/send/...",
"deviceLabel": "Můj notebook Chrome",
"createdAt": "2024-01-20T10:00:00.000Z"
}
]
}Viz Web Push pro kompletní dokumentaci Web Push integrace.