@hed-hog/core 0.0.349 → 0.0.351
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/access-log/access-log.controller.d.ts +16 -0
- package/dist/access-log/access-log.controller.d.ts.map +1 -0
- package/dist/access-log/access-log.controller.js +44 -0
- package/dist/access-log/access-log.controller.js.map +1 -0
- package/dist/access-log/access-log.interceptor.d.ts +9 -0
- package/dist/access-log/access-log.interceptor.d.ts.map +1 -0
- package/dist/access-log/access-log.interceptor.js +46 -0
- package/dist/access-log/access-log.interceptor.js.map +1 -0
- package/dist/access-log/access-log.module.d.ts +3 -0
- package/dist/access-log/access-log.module.d.ts.map +1 -0
- package/dist/access-log/access-log.module.js +29 -0
- package/dist/access-log/access-log.module.js.map +1 -0
- package/dist/access-log/access-log.service.d.ts +47 -0
- package/dist/access-log/access-log.service.d.ts.map +1 -0
- package/dist/access-log/access-log.service.js +113 -0
- package/dist/access-log/access-log.service.js.map +1 -0
- package/dist/access-log/dto/query-access-log.dto.d.ts +8 -0
- package/dist/access-log/dto/query-access-log.dto.d.ts.map +1 -0
- package/dist/access-log/dto/query-access-log.dto.js +42 -0
- package/dist/access-log/dto/query-access-log.dto.js.map +1 -0
- package/dist/auth/auth.controller.d.ts +12 -12
- package/dist/auth/auth.service.d.ts +27 -27
- package/dist/auth/auth.service.d.ts.map +1 -1
- package/dist/auth/auth.service.js +0 -4
- package/dist/auth/auth.service.js.map +1 -1
- package/dist/challenge/challenge.service.d.ts +2 -2
- package/dist/challenge/challenge.service.d.ts.map +1 -1
- package/dist/challenge/challenge.service.js +0 -1
- package/dist/challenge/challenge.service.js.map +1 -1
- package/dist/core/system.module.d.ts.map +1 -1
- package/dist/core/system.module.js +1 -0
- package/dist/core/system.module.js.map +1 -1
- package/dist/core.module.d.ts.map +1 -1
- package/dist/core.module.js +15 -0
- package/dist/core.module.js.map +1 -1
- package/dist/dashboard/dashboard-user/dashboard-user.controller.d.ts +3 -3
- package/dist/dashboard/dashboard-user/dashboard-user.service.d.ts +3 -3
- package/dist/dashboard/dashboard.module.d.ts.map +1 -1
- package/dist/dashboard/dashboard.module.js +4 -1
- package/dist/dashboard/dashboard.module.js.map +1 -1
- package/dist/file/file.controller.js +0 -1
- package/dist/file/file.controller.js.map +1 -1
- package/dist/file/file.service.d.ts +65 -0
- package/dist/file/file.service.d.ts.map +1 -1
- package/dist/file/file.service.js +151 -3
- package/dist/file/file.service.js.map +1 -1
- package/dist/file/provider/abstract.provider.d.ts +8 -0
- package/dist/file/provider/abstract.provider.d.ts.map +1 -1
- package/dist/file/provider/abstract.provider.js.map +1 -1
- package/dist/file/provider/azure.provider.d.ts +4 -0
- package/dist/file/provider/azure.provider.d.ts.map +1 -1
- package/dist/file/provider/azure.provider.js +14 -0
- package/dist/file/provider/azure.provider.js.map +1 -1
- package/dist/file/provider/gcs.provider.d.ts +4 -0
- package/dist/file/provider/gcs.provider.d.ts.map +1 -1
- package/dist/file/provider/gcs.provider.js +14 -0
- package/dist/file/provider/gcs.provider.js.map +1 -1
- package/dist/file/provider/local.provider.d.ts +4 -0
- package/dist/file/provider/local.provider.d.ts.map +1 -1
- package/dist/file/provider/local.provider.js +19 -0
- package/dist/file/provider/local.provider.js.map +1 -1
- package/dist/file/provider/provider.factory.d.ts.map +1 -1
- package/dist/file/provider/provider.factory.js +3 -0
- package/dist/file/provider/provider.factory.js.map +1 -1
- package/dist/file/provider/s3.provider.d.ts +4 -0
- package/dist/file/provider/s3.provider.d.ts.map +1 -1
- package/dist/file/provider/s3.provider.js +17 -0
- package/dist/file/provider/s3.provider.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/guards/mcp-auth.guard.d.ts +6 -1
- package/dist/mcp/guards/mcp-auth.guard.d.ts.map +1 -1
- package/dist/mcp/guards/mcp-auth.guard.js +29 -2
- package/dist/mcp/guards/mcp-auth.guard.js.map +1 -1
- package/dist/mcp/mcp-api-key.controller.d.ts +32 -0
- package/dist/mcp/mcp-api-key.controller.d.ts.map +1 -0
- package/dist/mcp/mcp-api-key.controller.js +64 -0
- package/dist/mcp/mcp-api-key.controller.js.map +1 -0
- package/dist/mcp/mcp-api-key.service.d.ts +27 -0
- package/dist/mcp/mcp-api-key.service.d.ts.map +1 -0
- package/dist/mcp/mcp-api-key.service.js +74 -0
- package/dist/mcp/mcp-api-key.service.js.map +1 -0
- package/dist/mcp/mcp-audit.service.d.ts +3 -1
- package/dist/mcp/mcp-audit.service.d.ts.map +1 -1
- package/dist/mcp/mcp-audit.service.js +14 -2
- package/dist/mcp/mcp-audit.service.js.map +1 -1
- package/dist/mcp/mcp-registry.service.d.ts +1 -2
- package/dist/mcp/mcp-registry.service.d.ts.map +1 -1
- package/dist/mcp/mcp-registry.service.js +6 -2
- package/dist/mcp/mcp-registry.service.js.map +1 -1
- package/dist/mcp/mcp.controller.d.ts +3 -1
- package/dist/mcp/mcp.controller.d.ts.map +1 -1
- package/dist/mcp/mcp.controller.js +10 -2
- package/dist/mcp/mcp.controller.js.map +1 -1
- package/dist/mcp/mcp.module.d.ts.map +1 -1
- package/dist/mcp/mcp.module.js +80 -1
- package/dist/mcp/mcp.module.js.map +1 -1
- package/dist/mcp/tools/core-ai.mcp-tools.d.ts +45 -0
- package/dist/mcp/tools/core-ai.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-ai.mcp-tools.js +214 -0
- package/dist/mcp/tools/core-ai.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-dashboard-items.mcp-tools.d.ts +21 -0
- package/dist/mcp/tools/core-dashboard-items.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-dashboard-items.mcp-tools.js +89 -0
- package/dist/mcp/tools/core-dashboard-items.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-dashboard.mcp-tools.d.ts +29 -0
- package/dist/mcp/tools/core-dashboard.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-dashboard.mcp-tools.js +149 -0
- package/dist/mcp/tools/core-dashboard.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-event-webhooks.mcp-tools.d.ts +30 -0
- package/dist/mcp/tools/core-event-webhooks.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-event-webhooks.mcp-tools.js +185 -0
- package/dist/mcp/tools/core-event-webhooks.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-files.mcp-tools.d.ts +26 -0
- package/dist/mcp/tools/core-files.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-files.mcp-tools.js +140 -0
- package/dist/mcp/tools/core-files.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-integration-events.mcp-tools.d.ts +26 -0
- package/dist/mcp/tools/core-integration-events.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-integration-events.mcp-tools.js +168 -0
- package/dist/mcp/tools/core-integration-events.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-mail-profile.mcp-tools.d.ts +32 -0
- package/dist/mcp/tools/core-mail-profile.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-mail-profile.mcp-tools.js +178 -0
- package/dist/mcp/tools/core-mail-profile.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-mail-sent.mcp-tools.d.ts +14 -0
- package/dist/mcp/tools/core-mail-sent.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-mail-sent.mcp-tools.js +106 -0
- package/dist/mcp/tools/core-mail-sent.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-mail.mcp-tools.d.ts +36 -0
- package/dist/mcp/tools/core-mail.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-mail.mcp-tools.js +184 -0
- package/dist/mcp/tools/core-mail.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-mcp-chat.mcp-tools.d.ts +21 -0
- package/dist/mcp/tools/core-mcp-chat.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-mcp-chat.mcp-tools.js +118 -0
- package/dist/mcp/tools/core-mcp-chat.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-menus.mcp-tools.d.ts +40 -0
- package/dist/mcp/tools/core-menus.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-menus.mcp-tools.js +268 -0
- package/dist/mcp/tools/core-menus.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-notifications.mcp-tools.d.ts +31 -0
- package/dist/mcp/tools/core-notifications.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-notifications.mcp-tools.js +178 -0
- package/dist/mcp/tools/core-notifications.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-profile.mcp-tools.d.ts +20 -0
- package/dist/mcp/tools/core-profile.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-profile.mcp-tools.js +111 -0
- package/dist/mcp/tools/core-profile.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-roles.mcp-tools.d.ts +70 -0
- package/dist/mcp/tools/core-roles.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-roles.mcp-tools.js +355 -0
- package/dist/mcp/tools/core-roles.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-routes.mcp-tools.d.ts +52 -0
- package/dist/mcp/tools/core-routes.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-routes.mcp-tools.js +254 -0
- package/dist/mcp/tools/core-routes.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-screens.mcp-tools.d.ts +47 -0
- package/dist/mcp/tools/core-screens.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-screens.mcp-tools.js +250 -0
- package/dist/mcp/tools/core-screens.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-sessions.mcp-tools.d.ts +20 -0
- package/dist/mcp/tools/core-sessions.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-sessions.mcp-tools.js +128 -0
- package/dist/mcp/tools/core-sessions.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-settings.mcp-tools.d.ts +25 -0
- package/dist/mcp/tools/core-settings.mcp-tools.d.ts.map +1 -1
- package/dist/mcp/tools/core-settings.mcp-tools.js +138 -0
- package/dist/mcp/tools/core-settings.mcp-tools.js.map +1 -1
- package/dist/mcp/tools/core-system.mcp-tools.d.ts +8 -0
- package/dist/mcp/tools/core-system.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-system.mcp-tools.js +40 -0
- package/dist/mcp/tools/core-system.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-webhooks.mcp-tools.d.ts +46 -0
- package/dist/mcp/tools/core-webhooks.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-webhooks.mcp-tools.js +266 -0
- package/dist/mcp/tools/core-webhooks.mcp-tools.js.map +1 -0
- package/dist/mcp-chat/mcp-chat.controller.d.ts +5 -1
- package/dist/mcp-chat/mcp-chat.controller.d.ts.map +1 -1
- package/dist/mcp-chat/mcp-chat.controller.js +46 -0
- package/dist/mcp-chat/mcp-chat.controller.js.map +1 -1
- package/dist/mcp-chat/mcp-chat.service.d.ts +31 -3
- package/dist/mcp-chat/mcp-chat.service.d.ts.map +1 -1
- package/dist/mcp-chat/mcp-chat.service.js +776 -38
- package/dist/mcp-chat/mcp-chat.service.js.map +1 -1
- package/dist/notification/dto/create-notification.dto.d.ts +26 -0
- package/dist/notification/dto/create-notification.dto.d.ts.map +1 -0
- package/dist/notification/dto/create-notification.dto.js +86 -0
- package/dist/notification/dto/create-notification.dto.js.map +1 -0
- package/dist/notification/dto/update-progress.dto.d.ts +6 -0
- package/dist/notification/dto/update-progress.dto.d.ts.map +1 -0
- package/dist/notification/dto/update-progress.dto.js +33 -0
- package/dist/notification/dto/update-progress.dto.js.map +1 -0
- package/dist/notification/notification.controller.d.ts +112 -0
- package/dist/notification/notification.controller.d.ts.map +1 -0
- package/dist/notification/notification.controller.js +130 -0
- package/dist/notification/notification.controller.js.map +1 -0
- package/dist/notification/notification.module.d.ts +3 -0
- package/dist/notification/notification.module.d.ts.map +1 -0
- package/dist/notification/notification.module.js +29 -0
- package/dist/notification/notification.module.js.map +1 -0
- package/dist/notification/notification.service.d.ts +112 -0
- package/dist/notification/notification.service.d.ts.map +1 -0
- package/dist/notification/notification.service.js +269 -0
- package/dist/notification/notification.service.js.map +1 -0
- package/dist/pdf/pdf.service.js +1 -1
- package/dist/pdf/pdf.service.js.map +1 -1
- package/dist/profile/profile.controller.d.ts +4 -4
- package/dist/profile/profile.controller.js +0 -1
- package/dist/profile/profile.controller.js.map +1 -1
- package/dist/profile/profile.module.d.ts.map +1 -1
- package/dist/profile/profile.module.js +1 -0
- package/dist/profile/profile.module.js.map +1 -1
- package/dist/profile/profile.service.d.ts +4 -4
- package/dist/session/session.controller.d.ts +3 -3
- package/dist/session/session.service.d.ts +9 -9
- package/dist/setting/dto/update-setting-list.dto.d.ts +9 -0
- package/dist/setting/dto/update-setting-list.dto.d.ts.map +1 -0
- package/dist/setting/dto/update-setting-list.dto.js +44 -0
- package/dist/setting/dto/update-setting-list.dto.js.map +1 -0
- package/dist/setting/setting.controller.d.ts +20 -1
- package/dist/setting/setting.controller.d.ts.map +1 -1
- package/dist/setting/setting.controller.js +12 -0
- package/dist/setting/setting.controller.js.map +1 -1
- package/dist/setting/setting.service.d.ts +20 -1
- package/dist/setting/setting.service.d.ts.map +1 -1
- package/dist/setting/setting.service.js +80 -4
- package/dist/setting/setting.service.js.map +1 -1
- package/dist/task/task.service.d.ts +13 -0
- package/dist/task/task.service.d.ts.map +1 -1
- package/dist/task/task.service.js +85 -0
- package/dist/task/task.service.js.map +1 -1
- package/dist/token/token.service.d.ts.map +1 -1
- package/dist/token/token.service.js +0 -1
- package/dist/token/token.service.js.map +1 -1
- package/dist/user/user.controller.d.ts +11 -11
- package/dist/user/user.service.d.ts +27 -27
- package/dist/webhook-integration/dto/webhook-action.dto.d.ts +22 -0
- package/dist/webhook-integration/dto/webhook-action.dto.d.ts.map +1 -0
- package/dist/webhook-integration/dto/webhook-action.dto.js +120 -0
- package/dist/webhook-integration/dto/webhook-action.dto.js.map +1 -0
- package/dist/webhook-integration/webhook-integration.controller.d.ts +7 -5
- package/dist/webhook-integration/webhook-integration.controller.d.ts.map +1 -1
- package/dist/webhook-integration/webhook-integration.controller.js +18 -5
- package/dist/webhook-integration/webhook-integration.controller.js.map +1 -1
- package/dist/webhook-integration/webhook-integration.service.d.ts +18 -5
- package/dist/webhook-integration/webhook-integration.service.d.ts.map +1 -1
- package/dist/webhook-integration/webhook-integration.service.js +342 -59
- package/dist/webhook-integration/webhook-integration.service.js.map +1 -1
- package/dist/webhook-integration/webhook-utils.d.ts +1 -0
- package/dist/webhook-integration/webhook-utils.d.ts.map +1 -1
- package/dist/webhook-integration/webhook-utils.js +38 -0
- package/dist/webhook-integration/webhook-utils.js.map +1 -1
- package/hedhog/data/menu.yaml +63 -4
- package/hedhog/data/route.yaml +1437 -0
- package/hedhog/data/setting_group.yaml +112 -0
- package/hedhog/data/setting_subgroup.yaml +32 -0
- package/hedhog/frontend/app/access-log/page.tsx.ejs +772 -0
- package/hedhog/frontend/app/account/components/mcp-tokens.tsx.ejs +285 -0
- package/hedhog/frontend/app/account/layout.tsx.ejs +32 -55
- package/hedhog/frontend/app/account/mcp-tokens/page.tsx.ejs +5 -0
- package/hedhog/frontend/app/ai_agent/page.tsx.ejs +10 -3
- package/hedhog/frontend/app/dashboard/dashboard-home-tabs.tsx.ejs +33 -13
- package/hedhog/frontend/app/dashboard/management/tabs/components-tab.tsx.ejs +12 -5
- package/hedhog/frontend/app/dashboard/management/tabs/dashboards-tab.tsx.ejs +12 -5
- package/hedhog/frontend/app/integrations-webhooks/page.tsx.ejs +3559 -1835
- package/hedhog/frontend/app/mcp_chat/chat-components.tsx.ejs +633 -0
- package/hedhog/frontend/app/mcp_chat/chat-types.ts.ejs +16 -0
- package/hedhog/frontend/app/mcp_chat/page.tsx.ejs +583 -384
- package/hedhog/frontend/app/menu/page.tsx.ejs +9 -3
- package/hedhog/frontend/app/roles/page.tsx.ejs +18 -6
- package/hedhog/frontend/app/routes/page.tsx.ejs +9 -3
- package/hedhog/frontend/app/setting-list/page.tsx.ejs +822 -0
- package/hedhog/frontend/app/users/page.tsx.ejs +445 -203
- package/hedhog/frontend/app/users/user-access-sheet.tsx.ejs +310 -304
- package/hedhog/frontend/app/users/user-sheet.tsx.ejs +41 -44
- package/hedhog/frontend/messages/en.json +343 -3
- package/hedhog/frontend/messages/pt.json +343 -3
- package/hedhog/table/access_log.yaml +31 -0
- package/hedhog/table/mcp_api_key.yaml +30 -0
- package/hedhog/table/notification.yaml +72 -0
- package/hedhog/table/webhook_action_log.yaml +49 -0
- package/package.json +5 -4
- package/src/access-log/access-log.controller.ts +29 -0
- package/src/access-log/access-log.interceptor.ts +38 -0
- package/src/access-log/access-log.module.ts +16 -0
- package/src/access-log/access-log.service.ts +129 -0
- package/src/access-log/dto/query-access-log.dto.ts +23 -0
- package/src/auth/auth.service.ts +0 -7
- package/src/challenge/challenge.service.ts +0 -2
- package/src/core/system.module.ts +1 -0
- package/src/core.module.ts +15 -0
- package/src/dashboard/dashboard.module.ts +4 -1
- package/src/file/file.controller.ts +14 -14
- package/src/file/file.service.ts +198 -4
- package/src/file/provider/abstract.provider.ts +10 -0
- package/src/file/provider/azure.provider.ts +24 -0
- package/src/file/provider/gcs.provider.ts +20 -0
- package/src/file/provider/local.provider.ts +30 -2
- package/src/file/provider/provider.factory.ts +3 -0
- package/src/file/provider/s3.provider.ts +22 -0
- package/src/index.ts +5 -0
- package/src/mcp/guards/mcp-auth.guard.ts +64 -32
- package/src/mcp/mcp-api-key.controller.ts +42 -0
- package/src/mcp/mcp-api-key.service.ts +66 -0
- package/src/mcp/mcp-audit.service.ts +47 -36
- package/src/mcp/mcp-registry.service.ts +75 -69
- package/src/mcp/mcp.controller.ts +40 -30
- package/src/mcp/mcp.module.ts +115 -36
- package/src/mcp/tools/core-ai.mcp-tools.ts +156 -0
- package/src/mcp/tools/core-dashboard-items.mcp-tools.ts +63 -0
- package/src/mcp/tools/core-dashboard.mcp-tools.ts +103 -0
- package/src/mcp/tools/core-event-webhooks.mcp-tools.ts +134 -0
- package/src/mcp/tools/core-files.mcp-tools.ts +105 -0
- package/src/mcp/tools/core-integration-events.mcp-tools.ts +118 -0
- package/src/mcp/tools/core-mail-profile.mcp-tools.ts +128 -0
- package/src/mcp/tools/core-mail-sent.mcp-tools.ts +76 -0
- package/src/mcp/tools/core-mail.mcp-tools.ts +130 -0
- package/src/mcp/tools/core-mcp-chat.mcp-tools.ts +81 -0
- package/src/mcp/tools/core-menus.mcp-tools.ts +197 -0
- package/src/mcp/tools/core-notifications.mcp-tools.ts +128 -0
- package/src/mcp/tools/core-profile.mcp-tools.ts +74 -0
- package/src/mcp/tools/core-roles.mcp-tools.ts +288 -0
- package/src/mcp/tools/core-routes.mcp-tools.ts +196 -0
- package/src/mcp/tools/core-screens.mcp-tools.ts +186 -0
- package/src/mcp/tools/core-sessions.mcp-tools.ts +97 -0
- package/src/mcp/tools/core-settings.mcp-tools.ts +171 -53
- package/src/mcp/tools/core-system.mcp-tools.ts +19 -0
- package/src/mcp/tools/core-webhooks.mcp-tools.ts +199 -0
- package/src/mcp-chat/mcp-chat.controller.ts +113 -60
- package/src/mcp-chat/mcp-chat.service.ts +1343 -332
- package/src/notification/dto/create-notification.dto.ts +71 -0
- package/src/notification/dto/update-progress.dto.ts +16 -0
- package/src/notification/notification.controller.ts +83 -0
- package/src/notification/notification.module.ts +16 -0
- package/src/notification/notification.service.ts +324 -0
- package/src/pdf/pdf.service.ts +1 -1
- package/src/profile/profile.controller.ts +1 -1
- package/src/profile/profile.module.ts +1 -0
- package/src/setting/dto/update-setting-list.dto.ts +32 -0
- package/src/setting/setting.controller.ts +9 -0
- package/src/setting/setting.service.ts +99 -11
- package/src/task/task.service.ts +103 -0
- package/src/token/token.service.ts +0 -2
- package/src/webhook-integration/dto/webhook-action.dto.ts +96 -0
- package/src/webhook-integration/webhook-integration.controller.ts +124 -103
- package/src/webhook-integration/webhook-integration.service.ts +1137 -735
- package/src/webhook-integration/webhook-utils.ts +136 -79
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IsBoolean,
|
|
3
|
+
IsDateString,
|
|
4
|
+
IsEnum,
|
|
5
|
+
IsNumber,
|
|
6
|
+
IsObject,
|
|
7
|
+
IsOptional,
|
|
8
|
+
IsString,
|
|
9
|
+
Max,
|
|
10
|
+
Min,
|
|
11
|
+
} from 'class-validator';
|
|
12
|
+
|
|
13
|
+
export enum NotificationType {
|
|
14
|
+
Info = 'info',
|
|
15
|
+
Success = 'success',
|
|
16
|
+
Warning = 'warning',
|
|
17
|
+
Error = 'error',
|
|
18
|
+
Progress = 'progress',
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export enum NotificationActionType {
|
|
22
|
+
Url = 'url',
|
|
23
|
+
Sheet = 'sheet',
|
|
24
|
+
Modal = 'modal',
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export class CreateNotificationDto {
|
|
28
|
+
@IsNumber()
|
|
29
|
+
user_id: number;
|
|
30
|
+
|
|
31
|
+
@IsString()
|
|
32
|
+
title: string;
|
|
33
|
+
|
|
34
|
+
@IsOptional()
|
|
35
|
+
@IsString()
|
|
36
|
+
body?: string;
|
|
37
|
+
|
|
38
|
+
@IsOptional()
|
|
39
|
+
@IsString()
|
|
40
|
+
icon?: string;
|
|
41
|
+
|
|
42
|
+
@IsOptional()
|
|
43
|
+
@IsEnum(NotificationType)
|
|
44
|
+
type?: NotificationType;
|
|
45
|
+
|
|
46
|
+
@IsOptional()
|
|
47
|
+
@IsEnum(NotificationActionType)
|
|
48
|
+
action_type?: NotificationActionType;
|
|
49
|
+
|
|
50
|
+
@IsOptional()
|
|
51
|
+
@IsObject()
|
|
52
|
+
action_data?: Record<string, unknown>;
|
|
53
|
+
|
|
54
|
+
@IsOptional()
|
|
55
|
+
@IsString()
|
|
56
|
+
action_url?: string;
|
|
57
|
+
|
|
58
|
+
@IsOptional()
|
|
59
|
+
@IsBoolean()
|
|
60
|
+
auto_remove?: boolean;
|
|
61
|
+
|
|
62
|
+
@IsOptional()
|
|
63
|
+
@IsNumber()
|
|
64
|
+
@Min(0)
|
|
65
|
+
@Max(100)
|
|
66
|
+
progress?: number;
|
|
67
|
+
|
|
68
|
+
@IsOptional()
|
|
69
|
+
@IsDateString()
|
|
70
|
+
started_at?: string;
|
|
71
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IsBoolean, IsNumber, IsOptional, IsString, Max, Min } from 'class-validator';
|
|
2
|
+
|
|
3
|
+
export class UpdateProgressDto {
|
|
4
|
+
@IsNumber()
|
|
5
|
+
@Min(0)
|
|
6
|
+
@Max(100)
|
|
7
|
+
progress: number;
|
|
8
|
+
|
|
9
|
+
@IsOptional()
|
|
10
|
+
@IsString()
|
|
11
|
+
body?: string;
|
|
12
|
+
|
|
13
|
+
@IsOptional()
|
|
14
|
+
@IsBoolean()
|
|
15
|
+
success?: boolean;
|
|
16
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Role, User } from '@hed-hog/api';
|
|
2
|
+
import { Pagination } from '@hed-hog/api-pagination';
|
|
3
|
+
import {
|
|
4
|
+
Body,
|
|
5
|
+
Controller,
|
|
6
|
+
Delete,
|
|
7
|
+
Get,
|
|
8
|
+
Param,
|
|
9
|
+
ParseIntPipe,
|
|
10
|
+
Patch,
|
|
11
|
+
Post,
|
|
12
|
+
Req,
|
|
13
|
+
Res,
|
|
14
|
+
} from '@nestjs/common';
|
|
15
|
+
import type { Request, Response } from 'express';
|
|
16
|
+
import { CreateNotificationDto } from './dto/create-notification.dto';
|
|
17
|
+
import { UpdateProgressDto } from './dto/update-progress.dto';
|
|
18
|
+
import { NotificationService } from './notification.service';
|
|
19
|
+
|
|
20
|
+
@Role()
|
|
21
|
+
@Controller('notification')
|
|
22
|
+
export class NotificationController {
|
|
23
|
+
constructor(private readonly notificationService: NotificationService) {}
|
|
24
|
+
|
|
25
|
+
@Get()
|
|
26
|
+
async list(@User() { id }, @Pagination() paginationParams) {
|
|
27
|
+
return this.notificationService.list(id, paginationParams);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@Get('stream')
|
|
31
|
+
async stream(
|
|
32
|
+
@User() { id },
|
|
33
|
+
@Req() req: Request,
|
|
34
|
+
@Res() res: Response,
|
|
35
|
+
) {
|
|
36
|
+
return this.notificationService.stream(id, req, res);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@Get('unread-count')
|
|
40
|
+
async unreadCount(@User() { id }) {
|
|
41
|
+
return this.notificationService.unreadCount(id);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@Patch('read-all')
|
|
45
|
+
async markAllRead(@User() { id }) {
|
|
46
|
+
return this.notificationService.markAllRead(id);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@Patch(':id/read')
|
|
50
|
+
async markRead(
|
|
51
|
+
@User() { id: userId },
|
|
52
|
+
@Param('id', ParseIntPipe) id: number,
|
|
53
|
+
) {
|
|
54
|
+
return this.notificationService.markRead(userId, id);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@Patch(':id/progress')
|
|
58
|
+
async updateProgress(
|
|
59
|
+
@User() { id: userId },
|
|
60
|
+
@Param('id', ParseIntPipe) id: number,
|
|
61
|
+
@Body() dto: UpdateProgressDto,
|
|
62
|
+
) {
|
|
63
|
+
return this.notificationService.updateProgress(userId, id, dto);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@Delete()
|
|
67
|
+
async deleteAll(@User() { id }) {
|
|
68
|
+
return this.notificationService.deleteAll(id);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@Delete(':id')
|
|
72
|
+
async delete(
|
|
73
|
+
@User() { id: userId },
|
|
74
|
+
@Param('id', ParseIntPipe) id: number,
|
|
75
|
+
) {
|
|
76
|
+
return this.notificationService.delete(userId, id);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@Post()
|
|
80
|
+
async create(@Body() data: CreateNotificationDto) {
|
|
81
|
+
return this.notificationService.create(data);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PaginationModule } from '@hed-hog/api-pagination';
|
|
2
|
+
import { PrismaModule } from '@hed-hog/api-prisma';
|
|
3
|
+
import { forwardRef, Module } from '@nestjs/common';
|
|
4
|
+
import { NotificationController } from './notification.controller';
|
|
5
|
+
import { NotificationService } from './notification.service';
|
|
6
|
+
|
|
7
|
+
@Module({
|
|
8
|
+
imports: [
|
|
9
|
+
forwardRef(() => PrismaModule),
|
|
10
|
+
forwardRef(() => PaginationModule),
|
|
11
|
+
],
|
|
12
|
+
controllers: [NotificationController],
|
|
13
|
+
providers: [NotificationService],
|
|
14
|
+
exports: [NotificationService],
|
|
15
|
+
})
|
|
16
|
+
export class NotificationModule {}
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import { PaginationService } from '@hed-hog/api-pagination';
|
|
2
|
+
import { PrismaService } from '@hed-hog/api-prisma';
|
|
3
|
+
import {
|
|
4
|
+
ForbiddenException,
|
|
5
|
+
forwardRef,
|
|
6
|
+
Inject,
|
|
7
|
+
Injectable,
|
|
8
|
+
Logger,
|
|
9
|
+
NotFoundException,
|
|
10
|
+
OnModuleDestroy,
|
|
11
|
+
OnModuleInit,
|
|
12
|
+
} from '@nestjs/common';
|
|
13
|
+
import type { Request, Response } from 'express';
|
|
14
|
+
import { randomUUID } from 'node:crypto';
|
|
15
|
+
import { EventEmitter } from 'node:events';
|
|
16
|
+
import { Client, type Notification as PgNotification } from 'pg';
|
|
17
|
+
import { CreateNotificationDto } from './dto/create-notification.dto';
|
|
18
|
+
import { UpdateProgressDto } from './dto/update-progress.dto';
|
|
19
|
+
|
|
20
|
+
type NotificationStreamEventType =
|
|
21
|
+
| 'ready'
|
|
22
|
+
| 'notification.created'
|
|
23
|
+
| 'notification.updated';
|
|
24
|
+
|
|
25
|
+
type NotificationStreamEvent = {
|
|
26
|
+
type: NotificationStreamEventType;
|
|
27
|
+
notificationId?: number;
|
|
28
|
+
notification?: unknown;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
type ClusterNotificationPayload = NotificationStreamEvent & {
|
|
32
|
+
userId: number;
|
|
33
|
+
originInstanceId: string;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
@Injectable()
|
|
37
|
+
export class NotificationService implements OnModuleInit, OnModuleDestroy {
|
|
38
|
+
private readonly logger = new Logger(NotificationService.name);
|
|
39
|
+
private readonly notificationEvents = new EventEmitter();
|
|
40
|
+
private readonly instanceId = randomUUID();
|
|
41
|
+
private readonly channelName = 'notification_events';
|
|
42
|
+
private pgClient: Client | null = null;
|
|
43
|
+
|
|
44
|
+
constructor(
|
|
45
|
+
@Inject(forwardRef(() => PrismaService))
|
|
46
|
+
private readonly prisma: PrismaService,
|
|
47
|
+
@Inject(forwardRef(() => PaginationService))
|
|
48
|
+
private readonly pagination: PaginationService,
|
|
49
|
+
) {
|
|
50
|
+
this.notificationEvents.setMaxListeners(0);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async onModuleInit() {
|
|
54
|
+
const databaseUrl = String(process.env.DATABASE_URL || '');
|
|
55
|
+
if (!databaseUrl.startsWith('postgresql://')) {
|
|
56
|
+
this.logger.warn(
|
|
57
|
+
'Cluster notification stream disabled because DATABASE_URL is not PostgreSQL',
|
|
58
|
+
);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
this.pgClient = new Client({ connectionString: databaseUrl });
|
|
63
|
+
this.pgClient.on('notification', (message: PgNotification) => {
|
|
64
|
+
this.handleClusterNotification(message);
|
|
65
|
+
});
|
|
66
|
+
this.pgClient.on('error', (error) => {
|
|
67
|
+
this.logger.error('Cluster notification listener error', error);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
await this.pgClient.connect();
|
|
71
|
+
await this.pgClient.query(`LISTEN ${this.channelName}`);
|
|
72
|
+
this.logger.log(
|
|
73
|
+
`Cluster notification listener ready on channel ${this.channelName}`,
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async onModuleDestroy() {
|
|
78
|
+
if (!this.pgClient) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
try {
|
|
83
|
+
await this.pgClient.query(`UNLISTEN ${this.channelName}`);
|
|
84
|
+
} catch (error) {
|
|
85
|
+
this.logger.warn('Failed to unlisten notification channel', error as any);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
try {
|
|
89
|
+
await this.pgClient.end();
|
|
90
|
+
} finally {
|
|
91
|
+
this.pgClient = null;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
async list(userId: number, paginationParams: any) {
|
|
96
|
+
return this.pagination.paginate(
|
|
97
|
+
this.prisma.notification,
|
|
98
|
+
paginationParams,
|
|
99
|
+
{
|
|
100
|
+
where: { user_id: userId },
|
|
101
|
+
orderBy: { created_at: 'desc' },
|
|
102
|
+
},
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async unreadCount(userId: number) {
|
|
107
|
+
const count = await this.prisma.notification.count({
|
|
108
|
+
where: { user_id: userId, status: 'unread' },
|
|
109
|
+
});
|
|
110
|
+
return { count };
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
async markRead(userId: number, id: number) {
|
|
114
|
+
const notification = await this.assertOwnership(userId, id);
|
|
115
|
+
if (notification.auto_remove) {
|
|
116
|
+
const deleted = await this.prisma.notification.delete({ where: { id } });
|
|
117
|
+
await this.broadcastNotificationEvent(userId, {
|
|
118
|
+
type: 'notification.updated',
|
|
119
|
+
notificationId: id,
|
|
120
|
+
});
|
|
121
|
+
return deleted;
|
|
122
|
+
}
|
|
123
|
+
const updated = await this.prisma.notification.update({
|
|
124
|
+
where: { id },
|
|
125
|
+
data: { status: 'read' },
|
|
126
|
+
});
|
|
127
|
+
await this.broadcastNotificationEvent(userId, {
|
|
128
|
+
type: 'notification.updated',
|
|
129
|
+
notificationId: id,
|
|
130
|
+
});
|
|
131
|
+
return updated;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
async markAllRead(userId: number) {
|
|
135
|
+
await this.prisma.notification.deleteMany({
|
|
136
|
+
where: { user_id: userId, status: 'unread', auto_remove: true },
|
|
137
|
+
});
|
|
138
|
+
const updated = await this.prisma.notification.updateMany({
|
|
139
|
+
where: { user_id: userId, status: 'unread' },
|
|
140
|
+
data: { status: 'read' },
|
|
141
|
+
});
|
|
142
|
+
await this.broadcastNotificationEvent(userId, { type: 'notification.updated' });
|
|
143
|
+
return updated;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
async delete(userId: number, id: number) {
|
|
147
|
+
await this.assertOwnership(userId, id);
|
|
148
|
+
const deleted = await this.prisma.notification.delete({ where: { id } });
|
|
149
|
+
await this.broadcastNotificationEvent(userId, {
|
|
150
|
+
type: 'notification.updated',
|
|
151
|
+
notificationId: id,
|
|
152
|
+
});
|
|
153
|
+
return deleted;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
async deleteAll(userId: number) {
|
|
157
|
+
const result = await this.prisma.notification.deleteMany({
|
|
158
|
+
where: { user_id: userId },
|
|
159
|
+
});
|
|
160
|
+
await this.broadcastNotificationEvent(userId, { type: 'notification.updated' });
|
|
161
|
+
return result;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
async create(data: CreateNotificationDto) {
|
|
165
|
+
const notification = await this.prisma.notification.create({
|
|
166
|
+
data: {
|
|
167
|
+
user_id: data.user_id,
|
|
168
|
+
title: data.title,
|
|
169
|
+
body: data.body,
|
|
170
|
+
icon: data.icon,
|
|
171
|
+
type: (data.type as any) ?? 'info',
|
|
172
|
+
action_type: (data.action_type as any) ?? 'url',
|
|
173
|
+
action_data: data.action_data as any,
|
|
174
|
+
action_url: data.action_url,
|
|
175
|
+
auto_remove: data.auto_remove ?? false,
|
|
176
|
+
progress: data.progress,
|
|
177
|
+
started_at: data.started_at ? new Date(data.started_at) : undefined,
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
await this.broadcastNotificationEvent(data.user_id, {
|
|
181
|
+
type: 'notification.created',
|
|
182
|
+
notificationId: notification.id,
|
|
183
|
+
notification,
|
|
184
|
+
});
|
|
185
|
+
return notification;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
async updateProgress(userId: number, id: number, dto: UpdateProgressDto) {
|
|
189
|
+
await this.assertOwnership(userId, id);
|
|
190
|
+
const finished = dto.progress >= 100;
|
|
191
|
+
const notification = await this.prisma.notification.update({
|
|
192
|
+
where: { id },
|
|
193
|
+
data: {
|
|
194
|
+
progress: dto.progress,
|
|
195
|
+
body: dto.body,
|
|
196
|
+
type: finished ? (dto.success === false ? 'error' : 'success') as any : undefined,
|
|
197
|
+
finished_at: finished ? new Date() : undefined,
|
|
198
|
+
},
|
|
199
|
+
});
|
|
200
|
+
await this.broadcastNotificationEvent(userId, {
|
|
201
|
+
type: 'notification.updated',
|
|
202
|
+
notificationId: id,
|
|
203
|
+
notification,
|
|
204
|
+
});
|
|
205
|
+
return notification;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
stream(userId: number, req: Request, res: Response) {
|
|
209
|
+
res.setHeader('Content-Type', 'text/event-stream; charset=utf-8');
|
|
210
|
+
res.setHeader('Cache-Control', 'no-cache, no-transform');
|
|
211
|
+
res.setHeader('Connection', 'keep-alive');
|
|
212
|
+
res.setHeader('X-Accel-Buffering', 'no');
|
|
213
|
+
res.flushHeaders();
|
|
214
|
+
|
|
215
|
+
const writeEvent = (event: NotificationStreamEvent) => {
|
|
216
|
+
if (res.writableEnded) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
res.write(`event: ${event.type}\n`);
|
|
221
|
+
res.write(`data: ${JSON.stringify(event)}\n\n`);
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
const eventKey = this.getEventKey(userId);
|
|
225
|
+
const handler = (event: NotificationStreamEvent) => {
|
|
226
|
+
writeEvent(event);
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
this.notificationEvents.on(eventKey, handler);
|
|
230
|
+
writeEvent({ type: 'ready' });
|
|
231
|
+
|
|
232
|
+
const heartbeat = setInterval(() => {
|
|
233
|
+
if (!res.writableEnded) {
|
|
234
|
+
res.write(': ping\n\n');
|
|
235
|
+
}
|
|
236
|
+
}, 25000);
|
|
237
|
+
|
|
238
|
+
const cleanup = () => {
|
|
239
|
+
clearInterval(heartbeat);
|
|
240
|
+
this.notificationEvents.off(eventKey, handler);
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
req.on('close', cleanup);
|
|
244
|
+
res.on('close', cleanup);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
async clearOldNotifications(retentionDays: number, batchLimit: number) {
|
|
248
|
+
return this.prisma.$executeRawUnsafe(
|
|
249
|
+
`WITH del AS (
|
|
250
|
+
SELECT id FROM notification
|
|
251
|
+
WHERE created_at < NOW() - INTERVAL '${retentionDays} days'
|
|
252
|
+
ORDER BY id
|
|
253
|
+
LIMIT ${batchLimit}
|
|
254
|
+
)
|
|
255
|
+
DELETE FROM notification n
|
|
256
|
+
USING del WHERE n.id = del.id`,
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
private async assertOwnership(userId: number, id: number) {
|
|
261
|
+
const notification = await this.prisma.notification.findUnique({
|
|
262
|
+
where: { id },
|
|
263
|
+
select: { user_id: true, auto_remove: true },
|
|
264
|
+
});
|
|
265
|
+
if (!notification) throw new NotFoundException();
|
|
266
|
+
if (notification.user_id !== userId) throw new ForbiddenException();
|
|
267
|
+
return notification;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
private async broadcastNotificationEvent(
|
|
271
|
+
userId: number,
|
|
272
|
+
event: NotificationStreamEvent,
|
|
273
|
+
) {
|
|
274
|
+
this.emitLocalNotificationEvent(userId, event);
|
|
275
|
+
|
|
276
|
+
const payload: ClusterNotificationPayload = {
|
|
277
|
+
...event,
|
|
278
|
+
userId,
|
|
279
|
+
originInstanceId: this.instanceId,
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
try {
|
|
283
|
+
await this.prisma.$executeRaw`
|
|
284
|
+
SELECT pg_notify(${this.channelName}, ${JSON.stringify(payload)})
|
|
285
|
+
`;
|
|
286
|
+
} catch (error) {
|
|
287
|
+
this.logger.warn('Failed to broadcast notification event', error as any);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
private getEventKey(userId: number) {
|
|
292
|
+
return `notification:${userId}`;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
private emitLocalNotificationEvent(
|
|
296
|
+
userId: number,
|
|
297
|
+
event: NotificationStreamEvent,
|
|
298
|
+
) {
|
|
299
|
+
this.notificationEvents.emit(this.getEventKey(userId), event);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
private handleClusterNotification(message: PgNotification) {
|
|
303
|
+
if (message.channel !== this.channelName || !message.payload) {
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
let payload: ClusterNotificationPayload;
|
|
308
|
+
try {
|
|
309
|
+
payload = JSON.parse(message.payload) as ClusterNotificationPayload;
|
|
310
|
+
} catch {
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
if (!payload || payload.originInstanceId === this.instanceId) {
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
this.emitLocalNotificationEvent(payload.userId, {
|
|
319
|
+
type: payload.type,
|
|
320
|
+
notificationId: payload.notificationId,
|
|
321
|
+
notification: payload.notification,
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
}
|
package/src/pdf/pdf.service.ts
CHANGED
|
@@ -182,7 +182,7 @@ export class PdfService {
|
|
|
182
182
|
|
|
183
183
|
if (missingRuntime) {
|
|
184
184
|
throw new InternalServerErrorException(
|
|
185
|
-
'Playwright runtime is not available. Run `
|
|
185
|
+
'Playwright runtime is not available. Run `pnpm --filter api run playwright:install` in the API environment.',
|
|
186
186
|
);
|
|
187
187
|
}
|
|
188
188
|
|
|
@@ -81,7 +81,7 @@ export class ProfileController {
|
|
|
81
81
|
|
|
82
82
|
@Post('mfa/email/verify/confirm')
|
|
83
83
|
sendEmailVerificationMfaConfirm(@User() {id}, @Body() data: EmailVerificationDto, @Locale() locale: string) {
|
|
84
|
-
|
|
84
|
+
|
|
85
85
|
return this.profileService.confirmEmailVerificationMfa(locale, id, data);
|
|
86
86
|
}
|
|
87
87
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Type } from 'class-transformer';
|
|
2
|
+
import {
|
|
3
|
+
IsArray,
|
|
4
|
+
IsInt,
|
|
5
|
+
IsOptional,
|
|
6
|
+
IsString,
|
|
7
|
+
Length,
|
|
8
|
+
ValidateNested,
|
|
9
|
+
} from 'class-validator';
|
|
10
|
+
|
|
11
|
+
export class UpdateSettingListItemDTO {
|
|
12
|
+
@IsOptional()
|
|
13
|
+
@Type(() => Number)
|
|
14
|
+
@IsInt()
|
|
15
|
+
id?: number;
|
|
16
|
+
|
|
17
|
+
@IsString()
|
|
18
|
+
@Length(1, 255)
|
|
19
|
+
value: string;
|
|
20
|
+
|
|
21
|
+
@IsOptional()
|
|
22
|
+
@Type(() => Number)
|
|
23
|
+
@IsInt()
|
|
24
|
+
order?: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export class UpdateSettingListDTO {
|
|
28
|
+
@IsArray()
|
|
29
|
+
@ValidateNested({ each: true })
|
|
30
|
+
@Type(() => UpdateSettingListItemDTO)
|
|
31
|
+
options: UpdateSettingListItemDTO[];
|
|
32
|
+
}
|
|
@@ -27,6 +27,7 @@ import { DeleteDTO } from './dto/delete.dto';
|
|
|
27
27
|
import { ExportDto } from './dto/export.dto';
|
|
28
28
|
import { SettingUserDTO } from './dto/setting-user.dto';
|
|
29
29
|
import { SettingDTO } from './dto/setting.dto';
|
|
30
|
+
import { UpdateSettingListDTO } from './dto/update-setting-list.dto';
|
|
30
31
|
import { UpdateDTO } from './dto/update.dto';
|
|
31
32
|
import { SettingService } from './setting.service';
|
|
32
33
|
|
|
@@ -124,6 +125,14 @@ export class SettingsController {
|
|
|
124
125
|
return this.settingService.updateFromSlug(slug, data);
|
|
125
126
|
}
|
|
126
127
|
|
|
128
|
+
@Put(':settingId/options')
|
|
129
|
+
async updateSettingListOptions(
|
|
130
|
+
@Param('settingId', ParseIntPipe) settingId: number,
|
|
131
|
+
@Body() data: UpdateSettingListDTO,
|
|
132
|
+
) {
|
|
133
|
+
return this.settingService.updateSettingListOptions(settingId, data);
|
|
134
|
+
}
|
|
135
|
+
|
|
127
136
|
@Put()
|
|
128
137
|
async setManySettings(@Body() data: SettingDTO) {
|
|
129
138
|
return this.settingService.setManySettings(data);
|