adminizer 4.3.0-build.94 → 4.3.0-build.96

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.
@@ -2,6 +2,7 @@ import { FormHelper } from "../helpers/formHelper";
2
2
  import { Adminizer } from "../lib/Adminizer";
3
3
  import inertiaFormHelper from "../helpers/inertiaFromHelper";
4
4
  import { getRelationsMediaManager } from "../lib/media-manager/helpers/MediaManagerHelper";
5
+ import { MediaManagerHandler } from "../lib/media-manager/MediaManagerHandler";
5
6
  export default async function form(req, res) {
6
7
  let slug = req.params.slug;
7
8
  // Check slug
@@ -42,6 +43,11 @@ export default async function form(req, res) {
42
43
  if (form[key].type === "boolean") {
43
44
  checkboxes.push(key);
44
45
  }
46
+ if (form[key].type === "mediamanager") {
47
+ let options = form[key].options;
48
+ let mediaManager = MediaManagerHandler.get(options?.id ?? "default");
49
+ await mediaManager.setRelations(req.body[key], "form", `${slug}_${key}`, key);
50
+ }
45
51
  }
46
52
  for (let field of Object.keys(req.body)) {
47
53
  await req.adminizer.config.forms.set(slug, field, req.body[field]);
package/lib/Adminizer.js CHANGED
@@ -233,12 +233,22 @@ export class Adminizer {
233
233
  // Хелпер для отправки уведомлений
234
234
  async sendNotification(notification) {
235
235
  const notificationClass = notification.notificationClass || 'general';
236
- return this.notificationHandler.dispatchNotification(notificationClass, notification);
236
+ if (this.config.notifications.enabled) {
237
+ return this.notificationHandler.dispatchNotification(notificationClass, notification);
238
+ }
239
+ else {
240
+ return Promise.resolve(false);
241
+ }
237
242
  }
238
243
  // Хелпер для системных событий
239
244
  async logSystemEvent(title, message, metadata) {
240
245
  const systemNotificationService = this.notificationHandler.getService('system');
241
- return systemNotificationService.logSystemEvent(title, message, 'system', metadata);
246
+ if (this.config.notifications.enabled) {
247
+ return systemNotificationService.logSystemEvent(title, message, 'system', metadata);
248
+ }
249
+ else {
250
+ return Promise.resolve(false);
251
+ }
242
252
  }
243
253
  // Хелпер для CRUD системных событий
244
254
  async logSystemCreatedEvent(title, message, metadata) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "adminizer",
3
3
  "type": "module",
4
- "version": "4.3.0-build.94",
4
+ "version": "4.3.0-build.96",
5
5
  "main": "index.js",
6
6
  "exports": {
7
7
  ".": "./index.js",