adminizer 4.6.0 → 4.7.0-build.221
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/Readme.md +12 -0
- package/assets/RelationDialogStack-CnHFOYyR.css +1 -0
- package/assets/RelationDialogStack-DI2bZxQX.js +20 -0
- package/assets/add-4213XScp.js +1 -0
- package/assets/add-group--F1XxfJ1.js +1 -0
- package/assets/add-group-form-DKRXC2n-.js +1 -0
- package/assets/add-user-b9HfMq7z.js +1 -0
- package/assets/add-user-form-UXAToWQd.js +1 -0
- package/assets/app-Clx8f5hd.css +1 -0
- package/assets/app-layout-C02ja4OI.js +1 -0
- package/assets/app-shell-D8wtkECO.js +1 -0
- package/assets/app-sidebar-BR5_zwxj.js +1 -0
- package/assets/app-sidebar-header-BZbIBQjq.js +1 -0
- package/assets/app.js +59 -7990
- package/assets/breadcrumbs-CODaqVkB.js +1 -0
- package/assets/catalog-6ZZjWdFs.js +6 -0
- package/assets/dashboard-CftAdKiH.js +3 -0
- package/assets/date-picker-DSOkNiNo.js +1 -0
- package/assets/del-modal-Cd4M7af8.js +1 -0
- package/assets/dynamic-controls-BsrJhPDY.js +1 -0
- package/assets/geo-json-CzR5JBXL.js +1 -0
- package/assets/handsontable-BI98OF5R.js +336 -0
- package/assets/history-DLHSU7Ak.js +1 -0
- package/assets/home-NcQ7nnU0.js +2 -0
- package/assets/icon-C2JNaLxH.js +1 -0
- package/assets/init-user-D2HSyXup.js +1 -0
- package/assets/input-error-CH2caTtO.js +1 -0
- package/assets/jsoneditor-DVNQmA6G.js +3869 -0
- package/assets/list-CFU0-TgN.js +4 -0
- package/assets/login-DFSLEO17.js +1 -0
- package/assets/manifest.json +246 -273
- package/assets/material-icon-Bx9pGQiQ.js +1 -0
- package/assets/media-manager-WcKe1EvD.js +6 -0
- package/assets/module-CT7PC6pc.js +1 -0
- package/assets/monaco-Bl4zdWCn.js +11 -0
- package/assets/nav-footer-BiSQkPt4.js +1 -0
- package/assets/nav-main-rTH0PfDw.js +1 -0
- package/assets/nav-user-Bj6cWs0a.js +1 -0
- package/assets/notification-Bi-PX87D.js +20 -0
- package/assets/pagination-render-AKJvTIRA.js +1 -0
- package/assets/register-BTP4uxsK.js +1 -0
- package/assets/ru-eW0WKkga.js +1 -0
- package/assets/theme-switcher-Dm8EOGzx.js +1 -0
- package/assets/toast-editor-DOg_gvSp.js +668 -0
- package/assets/user-filters-list-YUfR4XMI.js +1 -0
- package/assets/user-info-BgSbT02v.js +1 -0
- package/assets/user-menu-content-TQTXHIv6.js +1 -0
- package/assets/{vanilla-picker-l5rcX3cq.js → vanilla-picker-B3LgXoKV.js} +1 -7
- package/assets/welcome-vLwTu1R6.js +1 -0
- package/controllers/add.d.ts +1 -1
- package/controllers/add.js +20 -26
- package/controllers/addGroup.d.ts +1 -1
- package/controllers/addGroup.js +7 -15
- package/controllers/addUser.d.ts +1 -1
- package/controllers/addUser.js +10 -16
- package/controllers/catalog/Catalog.d.ts +1 -1
- package/controllers/catalog/Catalog.js +1 -10
- package/controllers/catalog/FrontendCatalogAdapter.d.ts +3 -3
- package/controllers/catalog/FrontendCatalogAdapter.js +0 -6
- package/controllers/catalog/FrontentCatalogAdapter.d.ts +3 -3
- package/controllers/catalog/FrontentCatalogAdapter.js +0 -4
- package/controllers/ckeditorUpload.js +2 -18
- package/controllers/dashboard.d.ts +1 -1
- package/controllers/dashboard.js +2 -5
- package/controllers/edit.js +24 -37
- package/controllers/editGroup.d.ts +1 -1
- package/controllers/editGroup.js +10 -21
- package/controllers/editUser.d.ts +1 -1
- package/controllers/editUser.js +11 -23
- package/controllers/exportData.d.ts +6 -0
- package/controllers/exportData.js +315 -0
- package/controllers/feed.d.ts +6 -0
- package/controllers/feed.js +73 -0
- package/controllers/feedback/feedbackController.d.ts +1 -1
- package/controllers/feedback/feedbackController.js +5 -7
- package/controllers/filter-fields/columns.d.ts +11 -0
- package/controllers/filter-fields/columns.js +106 -0
- package/controllers/filter-fields/filterFields.d.ts +10 -0
- package/controllers/filter-fields/filterFields.js +141 -0
- package/controllers/filter-fields/getAllUserFilters.d.ts +6 -0
- package/controllers/filter-fields/getAllUserFilters.js +115 -0
- package/controllers/filter-fields/groups.d.ts +5 -0
- package/controllers/filter-fields/groups.js +26 -0
- package/controllers/filter-fields/savedFilters.d.ts +25 -0
- package/controllers/filter-fields/savedFilters.js +317 -0
- package/controllers/getAllWidgets.d.ts +1 -1
- package/controllers/getAllWidgets.js +1 -9
- package/controllers/history-actions/HistoryController.js +6 -31
- package/controllers/initUser.js +6 -5
- package/controllers/inlineUpdate.d.ts +7 -0
- package/controllers/inlineUpdate.js +148 -0
- package/controllers/list.d.ts +1 -1
- package/controllers/list.js +383 -70
- package/controllers/listUserFilters.d.ts +5 -0
- package/controllers/listUserFilters.js +26 -0
- package/controllers/login.js +2 -2
- package/controllers/media-manager/mediaManagerApi.js +0 -9
- package/controllers/navigation/edit.js +3 -9
- package/controllers/notifications/NotificationController.d.ts +1 -1
- package/controllers/notifications/NotificationController.js +12 -36
- package/controllers/register.js +10 -9
- package/controllers/remove.js +10 -19
- package/controllers/timezones.d.ts +1 -1
- package/controllers/timezones.js +0 -6
- package/controllers/userApiKey.d.ts +7 -0
- package/controllers/userApiKey.js +36 -0
- package/controllers/view.js +14 -26
- package/controllers/welcome.d.ts +1 -1
- package/controllers/welcome.js +0 -4
- package/controllers/widgets/Action.d.ts +1 -1
- package/controllers/widgets/Action.js +1 -9
- package/controllers/widgets/Custom.d.ts +1 -1
- package/controllers/widgets/Custom.js +1 -9
- package/controllers/widgets/Info.d.ts +1 -1
- package/controllers/widgets/Info.js +1 -9
- package/controllers/widgets/filterInfo.d.ts +1 -0
- package/controllers/widgets/filterInfo.js +44 -0
- package/controllers/widgets/switch.d.ts +1 -1
- package/controllers/widgets/switch.js +1 -9
- package/controllers/widgetsDB.d.ts +1 -1
- package/controllers/widgetsDB.js +2 -8
- package/helpers/accessRightsHelper.d.ts +1 -1
- package/helpers/accessRightsHelper.js +5 -4
- package/helpers/apiKeyHelper.d.ts +5 -0
- package/helpers/apiKeyHelper.js +8 -0
- package/helpers/configHelper.js +12 -15
- package/helpers/controllerHelper.d.ts +14 -21
- package/helpers/controllerHelper.js +50 -83
- package/helpers/fieldsHelper.js +3 -3
- package/helpers/filterDatetimeHelper.d.ts +5 -0
- package/helpers/filterDatetimeHelper.js +84 -0
- package/helpers/inertiaActionsHelper.d.ts +2 -2
- package/helpers/inertiaActionsHelper.js +5 -4
- package/helpers/inertiaAddHelper.d.ts +3 -414
- package/helpers/inertiaAddHelper.js +39 -15
- package/helpers/inertiaGroupHelper.d.ts +2 -2
- package/helpers/inertiaGroupHelper.js +3 -3
- package/helpers/inertiaListHelper.d.ts +7 -3
- package/helpers/inertiaListHelper.js +26 -12
- package/helpers/inertiaMenuHelper.d.ts +1 -0
- package/helpers/inertiaMenuHelper.js +15 -3
- package/helpers/inertiaUserHelper.d.ts +3 -2
- package/helpers/inertiaUserHelper.js +7 -3
- package/helpers/menuHelper.d.ts +5 -2
- package/helpers/menuHelper.js +64 -12
- package/helpers/viteHelper.js +1 -2
- package/index.d.ts +6 -2
- package/index.js +6 -2
- package/interfaces/adminpanelConfig.d.ts +126 -39
- package/interfaces/internalModelAccess.d.ts +37 -0
- package/interfaces/internalModelAccess.js +1 -0
- package/interfaces/listQueryBuilder.d.ts +22 -0
- package/interfaces/listQueryBuilder.js +1 -0
- package/interfaces/queryCriteria.d.ts +54 -0
- package/interfaces/queryCriteria.js +1 -0
- package/interfaces/types.d.ts +1 -13
- package/lib/Adminizer.d.ts +4 -2
- package/lib/Adminizer.js +29 -10
- package/lib/DataAccessor.d.ts +8 -5
- package/lib/DataAccessor.js +89 -42
- package/lib/I18n.d.ts +5 -1
- package/lib/I18n.js +45 -19
- package/lib/MiddlewareManager.d.ts +8 -0
- package/lib/MiddlewareManager.js +53 -0
- package/lib/ai-assistant/OpenAiModelService.d.ts +3 -3
- package/lib/ai-assistant/OpenAiModelService.js +23 -24
- package/lib/catalog/Navigation.d.ts +1 -0
- package/lib/catalog/Navigation.js +12 -11
- package/lib/controls/jsoneditor/JsonEditor.d.ts +1 -2
- package/lib/controls/markdown/ToastUiEditor.d.ts +1 -2
- package/lib/feedback/FeedbackHandler.js +2 -2
- package/lib/filters/ConditionValidator.d.ts +107 -0
- package/lib/filters/ConditionValidator.js +483 -0
- package/lib/filters/CustomFilterHandler.d.ts +122 -0
- package/lib/filters/CustomFilterHandler.js +131 -0
- package/lib/filters/FilterCustomFieldHandler.d.ts +2 -0
- package/lib/filters/FilterCustomFieldHandler.js +2 -0
- package/lib/filters/FilterService.d.ts +82 -0
- package/lib/filters/FilterService.js +323 -0
- package/lib/filters/index.d.ts +6 -0
- package/lib/filters/index.js +4 -0
- package/lib/history-actions/AbstractHistoryAdapter.d.ts +5 -4
- package/lib/history-actions/AbstractHistoryAdapter.js +45 -30
- package/lib/history-actions/DefaultHistoryAdapter.d.ts +2 -0
- package/lib/history-actions/DefaultHistoryAdapter.js +12 -6
- package/lib/history-actions/HistoryHandler.js +1 -1
- package/lib/list-query-builder/ListQueryBuilder.d.ts +117 -0
- package/lib/list-query-builder/ListQueryBuilder.js +707 -0
- package/lib/media-manager/AbstractMediaManager.d.ts +9 -8
- package/lib/media-manager/DefaultMediaManager.d.ts +2 -0
- package/lib/media-manager/DefaultMediaManager.js +27 -15
- package/lib/media-manager/Items.d.ts +4 -1
- package/lib/media-manager/Items.js +62 -59
- package/lib/media-manager/MediaManagerHandler.js +1 -1
- package/lib/media-manager/helpers/MediaManagerHelper.d.ts +5 -1
- package/lib/media-manager/helpers/MediaManagerHelper.js +38 -4
- package/lib/model/AbstractModel.d.ts +33 -25
- package/lib/model/AbstractModel.js +54 -2
- package/lib/model/InternalModelAccessFactory.d.ts +18 -0
- package/lib/model/InternalModelAccessFactory.js +82 -0
- package/lib/model/ModelHandler.d.ts +6 -0
- package/lib/model/ModelHandler.js +14 -0
- package/lib/model/adapter/sequelize.d.ts +32 -10
- package/lib/model/adapter/sequelize.js +409 -62
- package/lib/model/adapter/typeorm.d.ts +62 -0
- package/lib/model/adapter/typeorm.js +777 -0
- package/lib/model/internalModelAccessToken.d.ts +1 -0
- package/lib/model/internalModelAccessToken.js +1 -0
- package/lib/model/internalModelRepository.d.ts +3 -0
- package/lib/model/internalModelRepository.js +4 -0
- package/lib/notifications/AbstractNotificationService.d.ts +3 -0
- package/lib/notifications/AbstractNotificationService.js +42 -36
- package/lib/notifications/GeneralNotificationService.js +37 -40
- package/lib/notifications/SystemNotificationService.js +33 -36
- package/lib/requestProcessor.js +0 -3
- package/lib/ui-i18n/getUiTranslations.d.ts +1 -0
- package/lib/ui-i18n/getUiTranslations.js +3 -0
- package/lib/ui-i18n/uiTranslationKeys.d.ts +6 -0
- package/lib/ui-i18n/uiTranslationKeys.js +268 -0
- package/lib/widgets/widgetHandler.d.ts +7 -2
- package/lib/widgets/widgetHandler.js +98 -18
- package/models/FilterAP.d.ts +116 -0
- package/models/FilterAP.js +68 -0
- package/models/FilterColumnAP.d.ts +32 -0
- package/models/FilterColumnAP.js +21 -0
- package/models/GroupAP.d.ts +1 -1
- package/models/HistoryActionsAP.d.ts +3 -3
- package/models/MediaManagerMetaAP.d.ts +1 -1
- package/models/NavigationAP.d.ts +1 -1
- package/models/UserAP.d.ts +6 -1
- package/models/UserAP.js +4 -0
- package/package.json +39 -32
- package/policies/authPolicies.d.ts +12 -0
- package/policies/authPolicies.js +104 -0
- package/policies/permissionResolvers.d.ts +12 -0
- package/policies/permissionResolvers.js +52 -0
- package/services/FeedService.d.ts +70 -0
- package/services/FeedService.js +334 -0
- package/system/Router.d.ts +1 -0
- package/system/Router.js +136 -59
- package/system/bindAccessRights.js +11 -30
- package/system/bindAuthorization.js +18 -18
- package/system/bindCors.js +16 -1
- package/system/bindCustomFilterHandlers.d.ts +2 -0
- package/system/bindCustomFilterHandlers.js +4 -0
- package/system/bindInertia.js +18 -61
- package/system/bindReqFunctions.js +10 -2
- package/system/bindTranslations.js +7 -3
- package/system/buildInternalModelAccess.d.ts +4 -0
- package/system/buildInternalModelAccess.js +59 -0
- package/system/defaults.js +18 -14
- package/system/routePolicies.d.ts +2 -0
- package/system/routePolicies.js +29 -0
- package/translations/en.json +151 -39
- package/translations/ru.json +211 -64
- package/ui/components/handsontable.js +13 -27
- package/ui/components/ui/dialog-stack.js +1 -3
- package/ui/components/ui/popover.js +1 -1
- package/ui/components/ui/sidebar.js +1 -1
- package/assets/RelationDialogStack-D9UVEF9s.js +0 -407
- package/assets/RelationDialogStack-DV8OITPR.css +0 -4
- package/assets/add-BlvzWQKF.js +0 -1
- package/assets/add-group-1Uoq9NWe.js +0 -1
- package/assets/add-group-form-B01gwDGu.js +0 -1
- package/assets/add-user-BQCAsaRy.js +0 -1
- package/assets/add-user-form-Cgwc9JkI.js +0 -1
- package/assets/app-DaOMy1nl.css +0 -72
- package/assets/app-layout-CAm60qoE.js +0 -1
- package/assets/app-shell-QWCtn9ye.js +0 -1
- package/assets/app-sidebar-CfaYbnSy.js +0 -1
- package/assets/app-sidebar-header-BsPFDhZ8.js +0 -1
- package/assets/breadcrumbs-CZZirDj8.js +0 -1
- package/assets/catalog-k5myk7fk.js +0 -6
- package/assets/dashboard-BkL9ybBw.js +0 -3
- package/assets/date-picker-B5AZ_7Q9.js +0 -1
- package/assets/del-modal-BoyXZloG.js +0 -1
- package/assets/dynamic-controls-k61T9W2P.js +0 -1
- package/assets/form-1WGY0YgG.js +0 -1
- package/assets/form-DJapG3qF.js +0 -1
- package/assets/geo-json-DsMUHo0l.js +0 -4
- package/assets/handsontable-PxYdjN8c.js +0 -298
- package/assets/history-CluyR-yJ.js +0 -1
- package/assets/home-Dug9zBzM.js +0 -2
- package/assets/icon-DfDLMG5f.js +0 -1
- package/assets/init-user-CF80MEnT.js +0 -1
- package/assets/input-error-DuuqFgZa.js +0 -1
- package/assets/jsoneditor-De1FvcYu.js +0 -3882
- package/assets/list-CuexshNt.js +0 -1
- package/assets/list-table-BsEWjTKY.js +0 -22
- package/assets/login-eDemYzN-.js +0 -1
- package/assets/material-icon-DMT8KdmE.js +0 -1
- package/assets/media-manager-DfYa_mT_.js +0 -14
- package/assets/module-Cd4Tm6uq.js +0 -1
- package/assets/monaco-BhBYtg3d.js +0 -11
- package/assets/nav-footer-D3olYxtz.js +0 -1
- package/assets/nav-main-BctqyzeV.js +0 -1
- package/assets/nav-user-Bn1Lt-BZ.js +0 -1
- package/assets/notification-D64qvni-.js +0 -27
- package/assets/pagination-render-DxD78ahJ.js +0 -1
- package/assets/register-349PwYbe.js +0 -1
- package/assets/theme-switcher-DfExsHW2.js +0 -1
- package/assets/toast-editor-ESK5iWPx.js +0 -845
- package/assets/user-info-DtBK5Kh8.js +0 -1
- package/assets/user-menu-content-0XYOCMaA.js +0 -1
- package/assets/welcome-PDp-gUei.js +0 -1
- package/controllers/form.d.ts +0 -1
- package/controllers/form.js +0 -86
- package/helpers/formHelper.d.ts +0 -6
- package/helpers/formHelper.js +0 -38
- package/helpers/inertiaFromHelper.d.ts +0 -11
- package/helpers/inertiaFromHelper.js +0 -98
- package/helpers/runtimeMode.d.ts +0 -1
- package/helpers/runtimeMode.js +0 -3
- package/lib/PolicyManager.d.ts +0 -8
- package/lib/PolicyManager.js +0 -53
- package/lib/datatable/NodeTable.d.ts +0 -49
- package/lib/datatable/NodeTable.js +0 -207
- package/lib/model/adapter/waterline.d.ts +0 -32
- package/lib/model/adapter/waterline.js +0 -180
- package/migrations/index.d.ts +0 -3
- package/migrations/index.js +0 -4
- package/migrations/knex/20250106000001_adminizer_init.d.ts +0 -8
- package/migrations/knex/20250106000001_adminizer_init.js +0 -164
- package/migrations/umzug/0001.d.ts +0 -7
- package/migrations/umzug/0001.js +0 -121
- package/migrations/umzugExports.d.ts +0 -2
- package/migrations/umzugExports.js +0 -9
- package/system/bindForms.d.ts +0 -2
- package/system/bindForms.js +0 -20
- /package/{policies → middlewares}/addMessages.d.ts +0 -0
- /package/{policies → middlewares}/addMessages.js +0 -0
- /package/{policies → middlewares}/checkAuth.d.ts +0 -0
- /package/{policies → middlewares}/checkAuth.js +0 -0
- /package/{policies → middlewares}/setLocale.d.ts +0 -0
- /package/{policies → middlewares}/setLocale.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const INTERNAL_MODEL_ACCESS_TOKEN: unique symbol;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const INTERNAL_MODEL_ACCESS_TOKEN = Symbol("InternalModelAccess");
|
|
@@ -56,6 +56,9 @@ export declare abstract class AbstractNotificationService extends EventEmitter {
|
|
|
56
56
|
abstract readonly icon: string;
|
|
57
57
|
abstract readonly iconColor: string;
|
|
58
58
|
constructor(adminizer: Adminizer);
|
|
59
|
+
protected notificationModel(): import("../..").InternalModelRepository<any>;
|
|
60
|
+
protected userNotificationModel(): import("../..").InternalModelRepository<any>;
|
|
61
|
+
protected userModel(): import("../..").InternalModelRepository<UserAP>;
|
|
59
62
|
private _bindAccessRight;
|
|
60
63
|
/**
|
|
61
64
|
* Registers a client for a user and associates it with a send function.
|
|
@@ -53,6 +53,15 @@ export class AbstractNotificationService extends EventEmitter {
|
|
|
53
53
|
this.adminizer = adminizer;
|
|
54
54
|
this._bindAccessRight();
|
|
55
55
|
}
|
|
56
|
+
notificationModel() {
|
|
57
|
+
return this.adminizer.modelHandler.internal("notifications").get("NotificationAP");
|
|
58
|
+
}
|
|
59
|
+
userNotificationModel() {
|
|
60
|
+
return this.adminizer.modelHandler.internal("notifications").get("UserNotificationAP");
|
|
61
|
+
}
|
|
62
|
+
userModel() {
|
|
63
|
+
return this.adminizer.modelHandler.internal("notifications").get("UserAP");
|
|
64
|
+
}
|
|
56
65
|
_bindAccessRight() {
|
|
57
66
|
setTimeout(() => {
|
|
58
67
|
this.adminizer.accessRightsHelper.registerToken({
|
|
@@ -80,7 +89,6 @@ export class AbstractNotificationService extends EventEmitter {
|
|
|
80
89
|
// We get the Map of the user's clients and add a new client
|
|
81
90
|
const userClients = this.clients.get(userId);
|
|
82
91
|
userClients.set(clientId, sendFn);
|
|
83
|
-
Adminizer.log.info(`[${this.notificationClass}] Client ${clientId} connected for user ${userId}. Total users: ${this.clients.size}, user clients: ${userClients.size}`);
|
|
84
92
|
}
|
|
85
93
|
/**
|
|
86
94
|
* Removes a client from the internal tracking structure.
|
|
@@ -96,7 +104,6 @@ export class AbstractNotificationService extends EventEmitter {
|
|
|
96
104
|
if (userClients.size === 0) {
|
|
97
105
|
this.clients.delete(userId);
|
|
98
106
|
}
|
|
99
|
-
Adminizer.log.info(`[${this.notificationClass}] Client ${clientId} disconnected from user ${userId}. Total users: ${this.clients.size}`);
|
|
100
107
|
return;
|
|
101
108
|
}
|
|
102
109
|
}
|
|
@@ -177,9 +184,9 @@ export class AbstractNotificationService extends EventEmitter {
|
|
|
177
184
|
* @returns {Promise<void>} A promise that resolves when the record is created or an error is logged.
|
|
178
185
|
*/
|
|
179
186
|
async createUserNotification(notificationId, userId) {
|
|
180
|
-
if (
|
|
187
|
+
if (userId) {
|
|
181
188
|
try {
|
|
182
|
-
await this.
|
|
189
|
+
await this.userNotificationModel().create({
|
|
183
190
|
userId: userId,
|
|
184
191
|
notificationId: notificationId,
|
|
185
192
|
read: false
|
|
@@ -198,18 +205,15 @@ export class AbstractNotificationService extends EventEmitter {
|
|
|
198
205
|
* @returns {Promise<any>} A promise that resolves with the found record or null if not found or an error occurs.
|
|
199
206
|
*/
|
|
200
207
|
async getUserNotification(notificationId, userId) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
return null;
|
|
210
|
-
}
|
|
208
|
+
try {
|
|
209
|
+
return await this.userNotificationModel().findOne({
|
|
210
|
+
where: { notificationId: notificationId, userId: userId }
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
catch (error) {
|
|
214
|
+
Adminizer.log.error(`Error getting user notification:`, error);
|
|
215
|
+
return null;
|
|
211
216
|
}
|
|
212
|
-
return null;
|
|
213
217
|
}
|
|
214
218
|
/**
|
|
215
219
|
* Retrieves a paginated list of notifications for a specific user, optionally filtered by read status.
|
|
@@ -220,17 +224,15 @@ export class AbstractNotificationService extends EventEmitter {
|
|
|
220
224
|
* @returns {Promise<INotification[]>} A promise that resolves with an array of notification objects.
|
|
221
225
|
*/
|
|
222
226
|
async getNotifications(userId, limit = 20, skip = 0, unreadOnly = false) {
|
|
223
|
-
if (!this.adminizer.modelHandler.model.has('notificationap')) {
|
|
224
|
-
return [];
|
|
225
|
-
}
|
|
226
227
|
try {
|
|
227
228
|
let query = { notificationClass: this.notificationClass };
|
|
228
229
|
// If notifications are requested for a specific user, we obtain the user's notification ID
|
|
229
|
-
const userNotifications = await this.
|
|
230
|
+
const userNotifications = await this.userNotificationModel().find({
|
|
230
231
|
where: {
|
|
231
232
|
userId: userId
|
|
232
|
-
}
|
|
233
|
-
|
|
233
|
+
},
|
|
234
|
+
populate: { notificationId: true }
|
|
235
|
+
});
|
|
234
236
|
const notificationIds = userNotifications.map((un) => un.notificationId.id);
|
|
235
237
|
if (unreadOnly) {
|
|
236
238
|
// Only unread
|
|
@@ -243,7 +245,7 @@ export class AbstractNotificationService extends EventEmitter {
|
|
|
243
245
|
}
|
|
244
246
|
if (query.id.length === 0)
|
|
245
247
|
return [];
|
|
246
|
-
const notificationsDB = await this.
|
|
248
|
+
const notificationsDB = await this.notificationModel().find({
|
|
247
249
|
where: query,
|
|
248
250
|
sort: 'createdAt DESC',
|
|
249
251
|
limit: limit,
|
|
@@ -288,15 +290,16 @@ export class AbstractNotificationService extends EventEmitter {
|
|
|
288
290
|
*/
|
|
289
291
|
async search(s, userId) {
|
|
290
292
|
try {
|
|
291
|
-
const userNotifications = await this.
|
|
293
|
+
const userNotifications = await this.userNotificationModel().find({
|
|
292
294
|
where: {
|
|
293
295
|
userId: userId
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
+
},
|
|
297
|
+
populate: { notificationId: true }
|
|
298
|
+
});
|
|
296
299
|
const notificationIds = userNotifications.map((un) => un.notificationId.id);
|
|
297
300
|
if (notificationIds.length === 0)
|
|
298
301
|
return [];
|
|
299
|
-
const notificationsDB = await this.
|
|
302
|
+
const notificationsDB = await this.notificationModel().find({
|
|
300
303
|
where: {
|
|
301
304
|
message: { contains: s },
|
|
302
305
|
id: notificationIds,
|
|
@@ -321,8 +324,8 @@ export class AbstractNotificationService extends EventEmitter {
|
|
|
321
324
|
try {
|
|
322
325
|
const userNotification = await this.getUserNotification(id, userId);
|
|
323
326
|
if (userNotification) {
|
|
324
|
-
await this.
|
|
325
|
-
id: userNotification.id
|
|
327
|
+
await this.userNotificationModel().update({
|
|
328
|
+
where: { id: userNotification.id }
|
|
326
329
|
}, { read: true });
|
|
327
330
|
}
|
|
328
331
|
}
|
|
@@ -337,11 +340,11 @@ export class AbstractNotificationService extends EventEmitter {
|
|
|
337
340
|
*/
|
|
338
341
|
async markAllAsRead(userId) {
|
|
339
342
|
try {
|
|
340
|
-
const userNotifications = await this.
|
|
343
|
+
const userNotifications = await this.userNotificationModel().find({
|
|
341
344
|
where: { userId: userId }
|
|
342
345
|
});
|
|
343
346
|
for (const userNotification of userNotifications) {
|
|
344
|
-
await this.
|
|
347
|
+
await this.userNotificationModel().update({
|
|
345
348
|
where: { id: userNotification.id },
|
|
346
349
|
}, { read: true });
|
|
347
350
|
}
|
|
@@ -372,9 +375,10 @@ export class AbstractNotificationService extends EventEmitter {
|
|
|
372
375
|
}
|
|
373
376
|
// if unreadOnly = false - we get ALL records (both read and not)
|
|
374
377
|
// We receive all user-notification communications
|
|
375
|
-
const userNotifications = await this.
|
|
376
|
-
where: whereClause
|
|
377
|
-
|
|
378
|
+
const userNotifications = await this.userNotificationModel().find({
|
|
379
|
+
where: whereClause,
|
|
380
|
+
populate: { notificationId: true }
|
|
381
|
+
});
|
|
378
382
|
if (userNotifications.length === 0)
|
|
379
383
|
return 0;
|
|
380
384
|
// Filter by notification class using notificationId
|
|
@@ -384,9 +388,11 @@ export class AbstractNotificationService extends EventEmitter {
|
|
|
384
388
|
if (validNotificationIds.length === 0)
|
|
385
389
|
return 0;
|
|
386
390
|
// We recalculate only those whose notificationClass matches
|
|
387
|
-
return await this.
|
|
388
|
-
|
|
389
|
-
|
|
391
|
+
return await this.notificationModel().count({
|
|
392
|
+
where: {
|
|
393
|
+
id: validNotificationIds,
|
|
394
|
+
notificationClass: this.notificationClass
|
|
395
|
+
}
|
|
390
396
|
});
|
|
391
397
|
}
|
|
392
398
|
catch (error) {
|
|
@@ -11,51 +11,48 @@ export class GeneralNotificationService extends AbstractNotificationService {
|
|
|
11
11
|
notificationClass: this.notificationClass
|
|
12
12
|
};
|
|
13
13
|
let notificationDB;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if (this.adminizer.accessRightsHelper.hasPermission(`notification-${this.notificationClass}`, user)) {
|
|
28
|
-
await this.createUserNotification(notificationDB.id, user.id);
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
Adminizer.log.error(`[${this.notificationClass}] User ${user.id} doesn't have permission to receive this notification`);
|
|
32
|
-
}
|
|
14
|
+
try {
|
|
15
|
+
notificationDB = await this.notificationModel().create(fullNotification);
|
|
16
|
+
if (notification.userId) {
|
|
17
|
+
// For specific user
|
|
18
|
+
await this.createUserNotification(notificationDB.id, notification.userId);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
// For all users
|
|
22
|
+
const users = await this.userModel().find({});
|
|
23
|
+
for (const user of users) {
|
|
24
|
+
try {
|
|
25
|
+
if (this.adminizer.accessRightsHelper.hasPermission(`notification-${this.notificationClass}`, user)) {
|
|
26
|
+
await this.createUserNotification(notificationDB.id, user.id);
|
|
33
27
|
}
|
|
34
|
-
|
|
35
|
-
Adminizer.log.
|
|
28
|
+
else {
|
|
29
|
+
Adminizer.log.warn(`[${this.notificationClass}] User ${user.id} doesn't have permission to receive this notification`);
|
|
36
30
|
}
|
|
37
31
|
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
Adminizer.log.error('Error creating UserNotificationAP:', error);
|
|
34
|
+
}
|
|
38
35
|
}
|
|
39
|
-
const event = {
|
|
40
|
-
type: 'notification',
|
|
41
|
-
data: {
|
|
42
|
-
...notificationDB,
|
|
43
|
-
read: false,
|
|
44
|
-
icon: {
|
|
45
|
-
icon: this.icon,
|
|
46
|
-
iconColor: this.iconColor
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
notificationClass: this.notificationClass,
|
|
50
|
-
userId: notification.userId ?? null
|
|
51
|
-
};
|
|
52
|
-
this.broadcast(event);
|
|
53
|
-
Adminizer.log.info(`[General] Notification dispatched: ${fullNotification.title}`);
|
|
54
|
-
return true;
|
|
55
|
-
}
|
|
56
|
-
catch (error) {
|
|
57
|
-
Adminizer.log.error('Error saving notification to database:', error);
|
|
58
36
|
}
|
|
37
|
+
const event = {
|
|
38
|
+
type: 'notification',
|
|
39
|
+
data: {
|
|
40
|
+
...notificationDB,
|
|
41
|
+
read: false,
|
|
42
|
+
icon: {
|
|
43
|
+
icon: this.icon,
|
|
44
|
+
iconColor: this.iconColor
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
notificationClass: this.notificationClass,
|
|
48
|
+
userId: notification.userId ?? null
|
|
49
|
+
};
|
|
50
|
+
this.broadcast(event);
|
|
51
|
+
Adminizer.log.info(`[General] Notification dispatched: ${fullNotification.title}`);
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
Adminizer.log.error('Error saving notification to database:', error);
|
|
59
56
|
}
|
|
60
57
|
return false;
|
|
61
58
|
}
|
|
@@ -14,47 +14,44 @@ export class SystemNotificationService extends AbstractNotificationService {
|
|
|
14
14
|
channel: notification.channel ?? ''
|
|
15
15
|
};
|
|
16
16
|
let notificationDB;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (this.adminizer.accessRightsHelper.hasPermission(`notification-${this.notificationClass}`, user)) {
|
|
25
|
-
await this.createUserNotification(notificationDB.id, user.id);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
catch (error) {
|
|
29
|
-
Adminizer.log.error('Error creating UserNotificationAP:', error);
|
|
17
|
+
try {
|
|
18
|
+
notificationDB = await this.notificationModel().create(fullNotification);
|
|
19
|
+
const users = await this.userModel().find({});
|
|
20
|
+
for (const user of users) {
|
|
21
|
+
try {
|
|
22
|
+
if (this.adminizer.accessRightsHelper.hasPermission(`notification-${this.notificationClass}`, user)) {
|
|
23
|
+
await this.createUserNotification(notificationDB.id, user.id);
|
|
30
24
|
}
|
|
31
25
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
data: {
|
|
35
|
-
...notificationDB,
|
|
36
|
-
icon: {
|
|
37
|
-
icon: this.icon,
|
|
38
|
-
iconColor: this.iconColor
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
notificationClass: this.notificationClass,
|
|
42
|
-
userId: notification.userId ?? null,
|
|
43
|
-
channel: notification.channel ?? 'system'
|
|
44
|
-
};
|
|
45
|
-
// Send to all channels or to a specific channel
|
|
46
|
-
if (notification.channel) {
|
|
47
|
-
this.broadcastToChannel(notification.channel, event);
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
this.broadcastToChannel('system', event);
|
|
26
|
+
catch (error) {
|
|
27
|
+
Adminizer.log.error('Error creating UserNotificationAP:', error);
|
|
51
28
|
}
|
|
52
|
-
Adminizer.log.info(`[System] Notification dispatched: ${fullNotification.title}`);
|
|
53
|
-
return true;
|
|
54
29
|
}
|
|
55
|
-
|
|
56
|
-
|
|
30
|
+
const event = {
|
|
31
|
+
type: 'notification',
|
|
32
|
+
data: {
|
|
33
|
+
...notificationDB,
|
|
34
|
+
icon: {
|
|
35
|
+
icon: this.icon,
|
|
36
|
+
iconColor: this.iconColor
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
notificationClass: this.notificationClass,
|
|
40
|
+
userId: notification.userId ?? null,
|
|
41
|
+
channel: notification.channel ?? 'system'
|
|
42
|
+
};
|
|
43
|
+
// Send to all channels or to a specific channel
|
|
44
|
+
if (notification.channel) {
|
|
45
|
+
this.broadcastToChannel(notification.channel, event);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
this.broadcastToChannel('system', event);
|
|
57
49
|
}
|
|
50
|
+
Adminizer.log.info(`[System] Notification dispatched: ${fullNotification.title}`);
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
Adminizer.log.error('Error saving system notification to database:', error);
|
|
58
55
|
}
|
|
59
56
|
return false;
|
|
60
57
|
}
|
package/lib/requestProcessor.js
CHANGED
|
@@ -29,9 +29,6 @@ export class RequestProcessor {
|
|
|
29
29
|
}
|
|
30
30
|
for (let key in postParams) {
|
|
31
31
|
let field = fields[key];
|
|
32
|
-
if (key === 'sort') {
|
|
33
|
-
console.log(fields[key], key, postParams[key]);
|
|
34
|
-
}
|
|
35
32
|
// if (field.model.type === 'boolean') {
|
|
36
33
|
// postParams[key] = ['true', '1', 'yes', "TRUE", "on"].includes(postParams[key].toString().toLowerCase());
|
|
37
34
|
// continue;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getUiTranslations(req: ReqType, keys: readonly string[]): Record<string, string>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const COMMON_UI_TRANSLATION_KEYS: readonly ["Delete", "Diff", "Preview", "Add", "Search", "Yes", "No", "On", "Off", "Hide", "Show", "No notifications found", "No notifications", "No widgets found", "Changes not found", "Old", "New", "Added", "Removed", "Updated", "changed type", "Error: Invalid field data", "Error: Fields data is invalid", "No fields to display", "Error: Some fields are missing required properties (name, type, label)", "Edit", "create", "Clean", "Are you sure?", "Select Item type", "Select Ids", "Open in a new window", "Visible", "Performing an action...", "Action completed", "Save", "First", "Last", "Previous", "Next", "Send feedback", "Feedback", "Title", "Description", "Attach files", "Send", "Sending...", "Feedback sent successfully", "Title is required", "File size exceeds the 5 MB limit", "Remove file", "Max 5 MB per file", "View All", "Make read", "Make all read", "Message", "Date", "Watch", "Current", "There is no history"];
|
|
2
|
+
export declare const FILTER_UI_TRANSLATION_KEYS: readonly ["Filters", "Saved filters", "Active filter", "Add filter", "Reset filter", "Reset", "Equal", "Not equal", "Contains", "Not contains", "Starts with", "Ends with", "Is empty", "Is not empty", "Greater than", "Greater or equal", "Less than", "Less or equal", "Between", "After", "After or equal", "Before", "Before or equal", "In list", "Not in list", "Is null", "Is not null", "Yes", "No", "From", "To", "From...", "To...", "Date...", "Today", "Month", "Month range", "Year", "Year range", "Value...", "Select...", "selected", "Search...", "No results", "Error", "Model not found", "Error applying filter", "Enter filter name", "Temporary filter", "Error: model not found", "Error loading columns", "Network error", "Columns settings", "Available columns", "Visible columns", "Add all", "Hide all", "No available columns", "Move columns here", "Save changes", "Apply", "Save", "Back", "Cancel", "conditions", "modified", "Private filter", "For groups", "Public filter", "Only for you", "For selected groups", "For all users", "Visible only to you", "Visible only to your group", "API access (feed)", "Hide", "Show", "Regenerate", "copied to clipboard", "Failed to copy", "Loading filters...", "No saved filters", "Save current filter for quick access", "Someone else's private filter (owner:", "unknown)", "Owner", "Apply filter", "Delete filter", "No permission to delete filter", "Edit filter", "New filter", "Filter conditions", "Add condition", "Select field", "No conditions. Add a condition above.", "Name", "Description", "Icon", "Color", "Filter parameters", "Change filter conditions and parameters", "Configure filter conditions", "Specify name and parameters for saving", "Someone else's private filter", "You cannot change someone else's filter visibility", "Private", "Public", "Visibility", "Export", "Exporting...", "Export is only available with an active filter", "Export to", "completed", "Export error", "Data in JSON format", "Text format CSV", "Excel file", "Conditions", "Access for groups", "Selected groups", "Groups list", "Columns", "Saving...", "Error saving filter", "Column configuration", "Select and arrange columns to display in the table", "Loading columns...", "Use buttons", "to move and", "to change order", "Add", "Edit", "Save filter", "and", "Custom filtering", "Select a saved filter or create a new one", "Select a filter or create a new one", "Filter visibility", "Unknown", "JSON URL", "XML URL", "API key is not created", "The key is not created. Create it or contact an administrator.", "OK"];
|
|
3
|
+
export declare const HISTORY_UI_TRANSLATION_KEYS: readonly ["Models", "All", "Users", "Date", "Pick a date", "Search", "Reset", "Model", "Name", "Event", "User", "Diff", "The end of the list has been reached", "There are no records to display"];
|
|
4
|
+
export declare const HISTORY_TABLE_UI_TRANSLATION_KEYS: readonly ["Event", "Date", "User", "Watch", "Current", "There is no history", "Diff"];
|
|
5
|
+
export declare const NOTIFICATION_UI_TRANSLATION_KEYS: readonly ["Make read", "View All", "Search", "Make all read", "Title", "Message", "Date", "Diff", "No notifications", "No notifications found", "The end of the list has been reached"];
|
|
6
|
+
export declare const USER_FILTERS_UI_TRANSLATION_KEYS: readonly ["Loading...", "Search filters...", "All models", "No filters found", "Loading more...", "Filter Name", "Model", "Visibility", "API access (feed)", "Owner", "Private", "Public", "Groups", "Yes", "No", "You", "Unknown", "Reset", "found", "User Filters"];
|