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
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { AbstractAdapter, AbstractModel } from "../AbstractModel.js";
|
|
2
|
-
import { v4 as uuid } from "uuid";
|
|
3
|
-
import Waterline from "waterline";
|
|
4
|
-
import path from "node:path";
|
|
5
|
-
import fs from "fs";
|
|
6
|
-
import { pathToFileURL } from "url";
|
|
7
|
-
export class WaterlineModel extends AbstractModel {
|
|
8
|
-
model;
|
|
9
|
-
constructor(modelName, model) {
|
|
10
|
-
super(modelName, model.attributes, model.primaryKey, model.identity);
|
|
11
|
-
if (!model) {
|
|
12
|
-
throw new Error('Model instance must be provided.');
|
|
13
|
-
}
|
|
14
|
-
this.model = model;
|
|
15
|
-
}
|
|
16
|
-
async _create(data) {
|
|
17
|
-
return await this.model.create(data).fetch();
|
|
18
|
-
}
|
|
19
|
-
/** Custom populate all function */
|
|
20
|
-
async populateAll(query, model) {
|
|
21
|
-
// Get 'model' and 'collection' fields
|
|
22
|
-
const associations = Object.keys(model.attributes)
|
|
23
|
-
.filter(attr => model.attributes[attr].model || model.attributes[attr].collection);
|
|
24
|
-
// Dynamically populate all associations
|
|
25
|
-
associations.forEach(attr => {
|
|
26
|
-
query = query.populate(attr);
|
|
27
|
-
});
|
|
28
|
-
return query;
|
|
29
|
-
}
|
|
30
|
-
async _findOne(criteria) {
|
|
31
|
-
let query = this.model.findOne(criteria);
|
|
32
|
-
query = await this.populateAll(query, this.model);
|
|
33
|
-
return await query;
|
|
34
|
-
}
|
|
35
|
-
async _find(criteria = {}, options = {}) {
|
|
36
|
-
// Hack
|
|
37
|
-
const attributes = this.model.attributes;
|
|
38
|
-
const associations = Object.keys(attributes).filter(attr => attributes[attr].model || attributes[attr].collection);
|
|
39
|
-
if (JSON.stringify(criteria.where) === '{}') {
|
|
40
|
-
let sortField;
|
|
41
|
-
if (criteria?.sort) {
|
|
42
|
-
if (typeof criteria.sort === 'string') {
|
|
43
|
-
sortField = criteria.sort.split(' ')[0];
|
|
44
|
-
}
|
|
45
|
-
else if (Array.isArray(criteria.sort)) {
|
|
46
|
-
sortField = criteria.sort[0];
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
if (sortField && associations.includes(sortField)) {
|
|
50
|
-
criteria.sort = undefined;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
let query = this.model.find(criteria);
|
|
54
|
-
if (options.populate && Array.isArray(options.populate) && options.populate.length > 0) {
|
|
55
|
-
options.populate.forEach(([field, populateCriteria]) => {
|
|
56
|
-
if (typeof field === "string") {
|
|
57
|
-
query = query.populate(field, populateCriteria || {});
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
query = await this.populateAll(query, this.model);
|
|
63
|
-
}
|
|
64
|
-
if (options.limit && typeof options.limit === "number") {
|
|
65
|
-
query = query.limit(options.limit);
|
|
66
|
-
}
|
|
67
|
-
let result = await query;
|
|
68
|
-
return result;
|
|
69
|
-
}
|
|
70
|
-
async _updateOne(criteria, data) {
|
|
71
|
-
return await this.model.updateOne(criteria).set(data);
|
|
72
|
-
}
|
|
73
|
-
async _update(criteria, data) {
|
|
74
|
-
return await this.model.update(criteria).set(data).fetch();
|
|
75
|
-
}
|
|
76
|
-
async _destroyOne(criteria) {
|
|
77
|
-
return await this.model.destroyOne(criteria);
|
|
78
|
-
}
|
|
79
|
-
async _destroy(criteria) {
|
|
80
|
-
return await this.model.destroy(criteria).fetch();
|
|
81
|
-
}
|
|
82
|
-
async _count(criteria = {}) {
|
|
83
|
-
return await this.model.count(criteria);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
export class WaterlineAdapter extends AbstractAdapter {
|
|
87
|
-
Model = WaterlineModel;
|
|
88
|
-
/** In case of waterline, we are storing complex object in "orm" field of our AbstractAdapter.
|
|
89
|
-
* It contains waterline orm and waterline ontology. One for storing methods like registerModel and initialize,
|
|
90
|
-
* the other for storing collections with methods find, create etc. Also, we need waterlineConfig */
|
|
91
|
-
constructor(orm) {
|
|
92
|
-
super("waterline", orm);
|
|
93
|
-
}
|
|
94
|
-
get models() {
|
|
95
|
-
return this.orm.ontology.collections;
|
|
96
|
-
}
|
|
97
|
-
getModel(modelName) {
|
|
98
|
-
const matchedKey = Object.keys(this.orm.ontology.collections).find(key => key.toLowerCase() === modelName.toLowerCase());
|
|
99
|
-
if (!matchedKey) {
|
|
100
|
-
return undefined;
|
|
101
|
-
}
|
|
102
|
-
return this.orm.ontology.collections[matchedKey];
|
|
103
|
-
}
|
|
104
|
-
getAttributes(modelName) {
|
|
105
|
-
const model = this.getModel(modelName);
|
|
106
|
-
if (!model) {
|
|
107
|
-
throw new Error(`Model "${modelName}" was not found`);
|
|
108
|
-
}
|
|
109
|
-
return model.attributes;
|
|
110
|
-
}
|
|
111
|
-
/** Method that processes custom waterline model creation. Is used for system models. Replaces beforeCreate method in waterline */
|
|
112
|
-
static async registerSystemModels(waterlineORM) {
|
|
113
|
-
let systemModelsDir = path.resolve(import.meta.dirname, "../../../../models");
|
|
114
|
-
if (!fs.existsSync(systemModelsDir)) {
|
|
115
|
-
systemModelsDir = path.resolve(import.meta.dirname, "../../../../src/models");
|
|
116
|
-
}
|
|
117
|
-
let systemModelsFiles = fs.readdirSync(systemModelsDir).filter(file => file.endsWith(".js"));
|
|
118
|
-
if (!systemModelsFiles.length) {
|
|
119
|
-
systemModelsFiles = fs.readdirSync(systemModelsDir).filter(file => file.endsWith(".ts") && !file.endsWith(".d.ts"));
|
|
120
|
-
}
|
|
121
|
-
// Register adminizer system models
|
|
122
|
-
await Promise.all(systemModelsFiles.map(async (file) => {
|
|
123
|
-
const modelName = path.basename(file).replace(/\.(ts|js)$/, "");
|
|
124
|
-
const systemModelPath = path.resolve(systemModelsDir, file);
|
|
125
|
-
const adminizerModel = (await import(pathToFileURL(systemModelPath).href)).default;
|
|
126
|
-
const waterlineLikeModel = generateWaterlineModel(modelName, structuredClone(adminizerModel));
|
|
127
|
-
// Register model in Waterline ORM
|
|
128
|
-
waterlineORM.registerModel(waterlineLikeModel);
|
|
129
|
-
}));
|
|
130
|
-
function generateWaterlineModel(modelName, attributes) {
|
|
131
|
-
attributes = JSON.parse(JSON.stringify(attributes));
|
|
132
|
-
const primaryKey = Object.keys(attributes).find(fieldName => attributes[fieldName]?.primaryKey === true);
|
|
133
|
-
if (!primaryKey) {
|
|
134
|
-
throw new Error(`Model "${modelName}" must have a primary key.`);
|
|
135
|
-
}
|
|
136
|
-
// Bind beforeCreate hook for creating UUID
|
|
137
|
-
let beforeCreate = (record, cb) => cb();
|
|
138
|
-
if (attributes[primaryKey]?.uuid === true && attributes[primaryKey]?.type === "string") {
|
|
139
|
-
beforeCreate = (record, cb) => {
|
|
140
|
-
if (!record.id) {
|
|
141
|
-
record.id = uuid();
|
|
142
|
-
}
|
|
143
|
-
cb();
|
|
144
|
-
};
|
|
145
|
-
// Delete uuid field after processing
|
|
146
|
-
delete attributes[primaryKey].uuid;
|
|
147
|
-
}
|
|
148
|
-
// Moving autoincrement and unique fields into autoMigrations
|
|
149
|
-
Object.keys(attributes).forEach((key) => {
|
|
150
|
-
if (!attributes[key].autoMigrations) {
|
|
151
|
-
attributes[key].autoMigrations = {};
|
|
152
|
-
}
|
|
153
|
-
if (attributes[key].autoIncrement) {
|
|
154
|
-
attributes[key].autoMigrations.autoIncrement = true;
|
|
155
|
-
delete attributes[key].autoIncrement;
|
|
156
|
-
}
|
|
157
|
-
if (attributes[key].unique) {
|
|
158
|
-
attributes[key].autoMigrations.unique = true;
|
|
159
|
-
delete attributes[key].unique;
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
// Convert date and datetime fields to ref
|
|
163
|
-
Object.keys(attributes).forEach((key) => {
|
|
164
|
-
const attr = attributes[key];
|
|
165
|
-
if (attr.type === 'datetime' || attr.type === 'date') {
|
|
166
|
-
attr.type = 'ref';
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
// Delete primaryKey key, waterline does not want it (wants only in upper level)
|
|
170
|
-
delete attributes[primaryKey].primaryKey;
|
|
171
|
-
return Waterline.Collection.extend({
|
|
172
|
-
identity: modelName.toLowerCase(),
|
|
173
|
-
datastore: 'default',
|
|
174
|
-
primaryKey: primaryKey,
|
|
175
|
-
attributes: attributes,
|
|
176
|
-
beforeCreate: beforeCreate
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
package/migrations/index.d.ts
DELETED
package/migrations/index.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Knex } from "knex";
|
|
2
|
-
/**
|
|
3
|
-
* Creates all system model tables for Adminizer
|
|
4
|
-
* Tables: userap, groupap, mediamanagerap, mediamanagermetaap, mediamanagerassociationsap,
|
|
5
|
-
* notificationap, usernotificationap, navigationap, groupapuserap
|
|
6
|
-
*/
|
|
7
|
-
export declare function up(knex: Knex): Promise<void>;
|
|
8
|
-
export declare function down(knex: Knex): Promise<void>;
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Creates all system model tables for Adminizer
|
|
3
|
-
* Tables: userap, groupap, mediamanagerap, mediamanagermetaap, mediamanagerassociationsap,
|
|
4
|
-
* notificationap, usernotificationap, navigationap, groupapuserap
|
|
5
|
-
*/
|
|
6
|
-
export async function up(knex) {
|
|
7
|
-
// Helper to get the correct default timestamp based on database client
|
|
8
|
-
const getDefaultTimestamp = () => {
|
|
9
|
-
const client = knex.client.config.client;
|
|
10
|
-
if (client === 'pg' || client === 'postgresql') {
|
|
11
|
-
return knex.raw('CURRENT_TIMESTAMP');
|
|
12
|
-
}
|
|
13
|
-
else if (client === 'sqlite3') {
|
|
14
|
-
return knex.raw("(datetime('now'))");
|
|
15
|
-
}
|
|
16
|
-
else if (client === 'mysql' || client === 'mysql2') {
|
|
17
|
-
return knex.raw('CURRENT_TIMESTAMP');
|
|
18
|
-
}
|
|
19
|
-
return knex.fn.now();
|
|
20
|
-
};
|
|
21
|
-
// Helper to get UUID default based on database client
|
|
22
|
-
const getUuidDefault = () => {
|
|
23
|
-
const client = knex.client.config.client;
|
|
24
|
-
if (client === 'pg' || client === 'postgresql') {
|
|
25
|
-
return knex.raw('gen_random_uuid()');
|
|
26
|
-
}
|
|
27
|
-
else if (client === 'sqlite3') {
|
|
28
|
-
// SQLite doesn't have native UUID, will need to handle in application
|
|
29
|
-
return undefined;
|
|
30
|
-
}
|
|
31
|
-
return knex.raw('UUID()');
|
|
32
|
-
};
|
|
33
|
-
const defaultTimestamp = getDefaultTimestamp();
|
|
34
|
-
const uuidDefault = getUuidDefault();
|
|
35
|
-
// userap
|
|
36
|
-
await knex.schema.createTable("userap", (table) => {
|
|
37
|
-
table.increments("id").primary().notNullable();
|
|
38
|
-
table.string("login").unique();
|
|
39
|
-
table.string("fullName");
|
|
40
|
-
table.string("email");
|
|
41
|
-
table.string("avatar");
|
|
42
|
-
table.string("passwordHashed");
|
|
43
|
-
table.string("timezone");
|
|
44
|
-
table.string("expires");
|
|
45
|
-
table.string("locale");
|
|
46
|
-
table.boolean("isDeleted");
|
|
47
|
-
table.boolean("isActive");
|
|
48
|
-
table.boolean("isAdministrator");
|
|
49
|
-
table.json("widgets");
|
|
50
|
-
table.boolean("isConfirmed");
|
|
51
|
-
table.timestamp("createdAt", { useTz: false }).notNullable().defaultTo(defaultTimestamp);
|
|
52
|
-
table.timestamp("updatedAt", { useTz: false }).notNullable().defaultTo(defaultTimestamp);
|
|
53
|
-
});
|
|
54
|
-
// groupap
|
|
55
|
-
await knex.schema.createTable("groupap", (table) => {
|
|
56
|
-
table.increments("id").primary().notNullable();
|
|
57
|
-
table.string("name").unique();
|
|
58
|
-
table.string("description");
|
|
59
|
-
table.json("tokens");
|
|
60
|
-
table.timestamp("createdAt", { useTz: false }).notNullable().defaultTo(defaultTimestamp);
|
|
61
|
-
table.timestamp("updatedAt", { useTz: false }).notNullable().defaultTo(defaultTimestamp);
|
|
62
|
-
});
|
|
63
|
-
// mediamanagerap (self-ref via parent)
|
|
64
|
-
await knex.schema.createTable("mediamanagerap", (table) => {
|
|
65
|
-
if (uuidDefault) {
|
|
66
|
-
table.uuid("id").primary().notNullable().defaultTo(uuidDefault);
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
table.uuid("id").primary().notNullable();
|
|
70
|
-
}
|
|
71
|
-
table.uuid("parent").nullable().references("id").inTable("mediamanagerap");
|
|
72
|
-
table.string("mimeType");
|
|
73
|
-
table.string("path");
|
|
74
|
-
table.integer("size");
|
|
75
|
-
table.string("group");
|
|
76
|
-
table.string("tag");
|
|
77
|
-
table.string("url");
|
|
78
|
-
table.string("filename");
|
|
79
|
-
table.timestamp("createdAt", { useTz: false }).notNullable().defaultTo(defaultTimestamp);
|
|
80
|
-
table.timestamp("updatedAt", { useTz: false }).notNullable().defaultTo(defaultTimestamp);
|
|
81
|
-
});
|
|
82
|
-
// mediamanagermetaap (belongsTo mediamanagerap via parent)
|
|
83
|
-
await knex.schema.createTable("mediamanagermetaap", (table) => {
|
|
84
|
-
if (uuidDefault) {
|
|
85
|
-
table.uuid("id").primary().notNullable().defaultTo(uuidDefault);
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
table.uuid("id").primary().notNullable();
|
|
89
|
-
}
|
|
90
|
-
table.string("key");
|
|
91
|
-
table.json("value");
|
|
92
|
-
table.boolean("isPublic");
|
|
93
|
-
table.uuid("parent").nullable().references("id").inTable("mediamanagerap");
|
|
94
|
-
table.timestamp("createdAt", { useTz: false }).notNullable().defaultTo(defaultTimestamp);
|
|
95
|
-
table.timestamp("updatedAt", { useTz: false }).notNullable().defaultTo(defaultTimestamp);
|
|
96
|
-
});
|
|
97
|
-
// mediamanagerassociationsap (belongsTo mediamanagerap via file)
|
|
98
|
-
await knex.schema.createTable("mediamanagerassociationsap", (table) => {
|
|
99
|
-
if (uuidDefault) {
|
|
100
|
-
table.uuid("id").primary().notNullable().defaultTo(uuidDefault);
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
table.uuid("id").primary().notNullable();
|
|
104
|
-
}
|
|
105
|
-
table.string("mediaManagerId");
|
|
106
|
-
table.string("model");
|
|
107
|
-
table.integer("modelId");
|
|
108
|
-
table.string("widgetName");
|
|
109
|
-
table.integer("sortOrder");
|
|
110
|
-
table.uuid("file").nullable().references("id").inTable("mediamanagerap");
|
|
111
|
-
table.timestamp("createdAt", { useTz: false }).notNullable().defaultTo(defaultTimestamp);
|
|
112
|
-
table.timestamp("updatedAt", { useTz: false }).notNullable().defaultTo(defaultTimestamp);
|
|
113
|
-
});
|
|
114
|
-
// notificationap
|
|
115
|
-
await knex.schema.createTable("notificationap", (table) => {
|
|
116
|
-
table.increments("id").primary().notNullable();
|
|
117
|
-
table.string("title");
|
|
118
|
-
table.string("message");
|
|
119
|
-
table.string("notificationClass");
|
|
120
|
-
table.string("channel");
|
|
121
|
-
table.json("metadata");
|
|
122
|
-
table.timestamp("createdAt", { useTz: false }).notNullable().defaultTo(defaultTimestamp);
|
|
123
|
-
table.timestamp("updatedAt", { useTz: false }).notNullable().defaultTo(defaultTimestamp);
|
|
124
|
-
});
|
|
125
|
-
// usernotificationap (FK to notificationap via column notificationIdId)
|
|
126
|
-
await knex.schema.createTable("usernotificationap", (table) => {
|
|
127
|
-
table.increments("id").primary().notNullable();
|
|
128
|
-
table.integer("userId");
|
|
129
|
-
table.integer("notificationIdId").nullable().references("id").inTable("notificationap");
|
|
130
|
-
table.boolean("read");
|
|
131
|
-
table.timestamp("createdAt", { useTz: false }).notNullable().defaultTo(defaultTimestamp);
|
|
132
|
-
table.timestamp("updatedAt", { useTz: false }).notNullable().defaultTo(defaultTimestamp);
|
|
133
|
-
});
|
|
134
|
-
// navigationap
|
|
135
|
-
await knex.schema.createTable("navigationap", (table) => {
|
|
136
|
-
table.increments("id").primary().notNullable();
|
|
137
|
-
table.string("label").unique();
|
|
138
|
-
table.json("tree");
|
|
139
|
-
table.timestamp("createdAt", { useTz: false }).notNullable().defaultTo(defaultTimestamp);
|
|
140
|
-
table.timestamp("updatedAt", { useTz: false }).notNullable().defaultTo(defaultTimestamp);
|
|
141
|
-
});
|
|
142
|
-
// M:N join: GroupAP <-> UserAP via "groupap_users__userap_groups"
|
|
143
|
-
// Waterline naming convention: {model1}_{collection1}__{model2}_{collection2}
|
|
144
|
-
// GroupAP.users -> UserAP.groups => groupap_users__userap_groups
|
|
145
|
-
// Column naming: {model}_{collection} references the TARGET model
|
|
146
|
-
await knex.schema.createTable("groupap_users__userap_groups", (table) => {
|
|
147
|
-
table.increments("id").primary().notNullable();
|
|
148
|
-
table.integer("groupap_users").notNullable().references("id").inTable("groupap");
|
|
149
|
-
table.integer("userap_groups").notNullable().references("id").inTable("userap");
|
|
150
|
-
table.timestamp("createdAt", { useTz: false }).notNullable().defaultTo(defaultTimestamp);
|
|
151
|
-
table.timestamp("updatedAt", { useTz: false }).notNullable().defaultTo(defaultTimestamp);
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
export async function down(knex) {
|
|
155
|
-
await knex.schema.dropTableIfExists("groupap_users__userap_groups");
|
|
156
|
-
await knex.schema.dropTableIfExists("usernotificationap");
|
|
157
|
-
await knex.schema.dropTableIfExists("mediamanagermetaap");
|
|
158
|
-
await knex.schema.dropTableIfExists("mediamanagerassociationsap");
|
|
159
|
-
await knex.schema.dropTableIfExists("mediamanagerap");
|
|
160
|
-
await knex.schema.dropTableIfExists("navigationap");
|
|
161
|
-
await knex.schema.dropTableIfExists("notificationap");
|
|
162
|
-
await knex.schema.dropTableIfExists("groupap");
|
|
163
|
-
await knex.schema.dropTableIfExists("userap");
|
|
164
|
-
}
|
package/migrations/umzug/0001.js
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { DataTypes } from "sequelize";
|
|
2
|
-
// Creates all system model tables according to src/models/* and
|
|
3
|
-
// SequelizeAdapter.generateSequelizeModel naming: tableName = modelName.toLowerCase()
|
|
4
|
-
// Associations:
|
|
5
|
-
// - UserAP <-> GroupAP: M:N via through table "groupapuserap" (UserAPId, GroupAPId)
|
|
6
|
-
// - MediaManagerAP.parent -> MediaManagerAP (parentId)
|
|
7
|
-
// - MediaManagerAP hasMany MediaManagerMetaAP via parent (MediaManagerMetaAP.parentId)
|
|
8
|
-
// - MediaManagerAP hasMany MediaManagerAssociationsAP via file (MediaManagerAssociationsAP.fileId)
|
|
9
|
-
// - UserNotificationAP belongsTo NotificationAP via alias "notificationId" -> FK column "notificationIdId"
|
|
10
|
-
export async function up({ context }) {
|
|
11
|
-
// userap
|
|
12
|
-
await context.createTable("userap", {
|
|
13
|
-
id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true, allowNull: false },
|
|
14
|
-
login: { type: DataTypes.STRING, unique: true },
|
|
15
|
-
fullName: { type: DataTypes.STRING },
|
|
16
|
-
email: { type: DataTypes.STRING },
|
|
17
|
-
avatar: { type: DataTypes.STRING },
|
|
18
|
-
passwordHashed: { type: DataTypes.STRING },
|
|
19
|
-
timezone: { type: DataTypes.STRING },
|
|
20
|
-
expires: { type: DataTypes.STRING },
|
|
21
|
-
locale: { type: DataTypes.STRING },
|
|
22
|
-
isDeleted: { type: DataTypes.BOOLEAN },
|
|
23
|
-
isActive: { type: DataTypes.BOOLEAN },
|
|
24
|
-
isAdministrator: { type: DataTypes.BOOLEAN },
|
|
25
|
-
widgets: { type: DataTypes.JSON },
|
|
26
|
-
isConfirmed: { type: DataTypes.BOOLEAN },
|
|
27
|
-
createdAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
28
|
-
updatedAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
29
|
-
});
|
|
30
|
-
// groupap
|
|
31
|
-
await context.createTable("groupap", {
|
|
32
|
-
id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true, allowNull: false },
|
|
33
|
-
name: { type: DataTypes.STRING, unique: true },
|
|
34
|
-
description: { type: DataTypes.STRING },
|
|
35
|
-
tokens: { type: DataTypes.JSON },
|
|
36
|
-
createdAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
37
|
-
updatedAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
38
|
-
});
|
|
39
|
-
// mediamanagerap (self-ref via parentId)
|
|
40
|
-
await context.createTable("mediamanagerap", {
|
|
41
|
-
id: { type: DataTypes.UUID, defaultValue: DataTypes.UUIDV4, primaryKey: true, allowNull: false },
|
|
42
|
-
parentId: { type: DataTypes.UUID, allowNull: true, references: { model: "mediamanagerap", key: "id" } },
|
|
43
|
-
mimeType: { type: DataTypes.STRING },
|
|
44
|
-
path: { type: DataTypes.STRING },
|
|
45
|
-
size: { type: DataTypes.INTEGER },
|
|
46
|
-
group: { type: DataTypes.STRING },
|
|
47
|
-
tag: { type: DataTypes.STRING },
|
|
48
|
-
url: { type: DataTypes.STRING },
|
|
49
|
-
filename: { type: DataTypes.STRING },
|
|
50
|
-
createdAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
51
|
-
updatedAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
52
|
-
});
|
|
53
|
-
// mediamanagermetaap (belongsTo mediamanagerap via parentId)
|
|
54
|
-
await context.createTable("mediamanagermetaap", {
|
|
55
|
-
id: { type: DataTypes.UUID, defaultValue: DataTypes.UUIDV4, primaryKey: true, allowNull: false },
|
|
56
|
-
key: { type: DataTypes.STRING },
|
|
57
|
-
value: { type: DataTypes.JSON },
|
|
58
|
-
isPublic: { type: DataTypes.BOOLEAN },
|
|
59
|
-
parentId: { type: DataTypes.UUID, allowNull: true, references: { model: "mediamanagerap", key: "id" } },
|
|
60
|
-
createdAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
61
|
-
updatedAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
62
|
-
});
|
|
63
|
-
// mediamanagerassociationsap (belongsTo mediamanagerap via fileId)
|
|
64
|
-
await context.createTable("mediamanagerassociationsap", {
|
|
65
|
-
id: { type: DataTypes.UUID, defaultValue: DataTypes.UUIDV4, primaryKey: true, allowNull: false },
|
|
66
|
-
mediaManagerId: { type: DataTypes.STRING },
|
|
67
|
-
model: { type: DataTypes.STRING },
|
|
68
|
-
modelId: { type: DataTypes.INTEGER },
|
|
69
|
-
widgetName: { type: DataTypes.STRING },
|
|
70
|
-
sortOrder: { type: DataTypes.INTEGER },
|
|
71
|
-
fileId: { type: DataTypes.UUID, allowNull: true, references: { model: "mediamanagerap", key: "id" } },
|
|
72
|
-
createdAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
73
|
-
updatedAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
74
|
-
});
|
|
75
|
-
// notificationap
|
|
76
|
-
await context.createTable("notificationap", {
|
|
77
|
-
id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true, allowNull: false },
|
|
78
|
-
title: { type: DataTypes.STRING },
|
|
79
|
-
message: { type: DataTypes.STRING },
|
|
80
|
-
notificationClass: { type: DataTypes.STRING },
|
|
81
|
-
channel: { type: DataTypes.STRING },
|
|
82
|
-
metadata: { type: DataTypes.JSON },
|
|
83
|
-
createdAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
84
|
-
updatedAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
85
|
-
});
|
|
86
|
-
// usernotificationap (FK to notificationap via column notificationIdId)
|
|
87
|
-
await context.createTable("usernotificationap", {
|
|
88
|
-
id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true, allowNull: false },
|
|
89
|
-
userId: { type: DataTypes.INTEGER },
|
|
90
|
-
notificationIdId: { type: DataTypes.INTEGER, allowNull: true, references: { model: "notificationap", key: "id" } },
|
|
91
|
-
read: { type: DataTypes.BOOLEAN },
|
|
92
|
-
createdAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
93
|
-
updatedAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
94
|
-
});
|
|
95
|
-
// navigationap
|
|
96
|
-
await context.createTable("navigationap", {
|
|
97
|
-
id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true, allowNull: false },
|
|
98
|
-
label: { type: DataTypes.STRING, unique: true },
|
|
99
|
-
tree: { type: DataTypes.JSON },
|
|
100
|
-
createdAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
101
|
-
updatedAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
102
|
-
});
|
|
103
|
-
// M:N join: GroupAP <-> UserAP via "groupapuserap"
|
|
104
|
-
await context.createTable("groupapuserap", {
|
|
105
|
-
UserAPId: { type: DataTypes.INTEGER, allowNull: false, references: { model: "userap", key: "id" } },
|
|
106
|
-
GroupAPId: { type: DataTypes.INTEGER, allowNull: false, references: { model: "groupap", key: "id" } },
|
|
107
|
-
createdAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
108
|
-
updatedAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
export async function down({ context }) {
|
|
112
|
-
await context.dropTable("groupapuserap");
|
|
113
|
-
await context.dropTable("usernotificationap");
|
|
114
|
-
await context.dropTable("mediamanagermetaap");
|
|
115
|
-
await context.dropTable("mediamanagerassociationsap");
|
|
116
|
-
await context.dropTable("mediamanagerap");
|
|
117
|
-
await context.dropTable("navigationap");
|
|
118
|
-
await context.dropTable("notificationap");
|
|
119
|
-
await context.dropTable("groupap");
|
|
120
|
-
await context.dropTable("userap");
|
|
121
|
-
}
|
package/system/bindForms.d.ts
DELETED
package/system/bindForms.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as fs from "fs";
|
|
2
|
-
import { FormHelper } from "../helpers/formHelper.js";
|
|
3
|
-
export default async function bindForms(adminizer) {
|
|
4
|
-
if (fs.existsSync(adminizer.config.forms.path)) {
|
|
5
|
-
let formsDir = fs.readdirSync(adminizer.config.forms.path);
|
|
6
|
-
if (formsDir.length) {
|
|
7
|
-
FormHelper.loadForms(adminizer, `${process.cwd()}/${adminizer.config.forms.path}`);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
adminizer.emitter.on("adminizer:loaded", async () => {
|
|
11
|
-
// Seeding forms data
|
|
12
|
-
for (let form in adminizer.config.forms.data) {
|
|
13
|
-
for (let key in adminizer.config.forms.data[form]) {
|
|
14
|
-
if (await adminizer.config.forms.get(form, key) === undefined) {
|
|
15
|
-
await adminizer.config.forms.set(form, key, adminizer.config.forms.data[form][key].value);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|