sitero 0.3.0 → 0.4.0
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/export/cms/client/components/index.js +1 -0
- package/dist/export/core/server/index.js +1 -0
- package/dist/prisma/generated/internal/class.js +4 -4
- package/dist/src/cms/client/infrastructure/i18n/messages/en-US/resources/file.js +17 -0
- package/dist/src/cms/client/infrastructure/i18n/messages/zh-TW/resources/file.js +17 -0
- package/dist/src/cms/client/interfaces/components/create-components.js +1 -0
- package/dist/src/cms/client/interfaces/components/create-post-contents.js +7 -4
- package/dist/src/cms/client/interfaces/components/resources/admin/author-fields.js +5 -0
- package/dist/src/cms/client/interfaces/components/resources/file/file-card.js +1 -1
- package/dist/src/cms/client/interfaces/components/resources/post/content/post-create-content.js +24 -6
- package/dist/src/cms/client/interfaces/components/resources/post/content/post-edit-content.js +27 -7
- package/dist/src/cms/client/interfaces/components/resources/post/content/post-show-content.js +13 -5
- package/dist/src/cms/client/interfaces/components/resources/post/content/resolve-control-field-label.js +9 -0
- package/dist/src/cms/client/interfaces/components/resources/post/post-list.js +5 -7
- package/dist/src/cms/client/interfaces/components/resources/post/search/control-field-filter-state.js +20 -0
- package/dist/src/cms/client/interfaces/components/resources/post/search/control-fields-filters.js +28 -14
- package/dist/src/cms/client/interfaces/components/ui/form/containers/side-fields.js +1 -1
- package/dist/src/cms/client/interfaces/components/ui/form/control-fields/control-fields-display.js +19 -9
- package/dist/src/cms/client/interfaces/components/ui/form/control-fields/control-fields-input.js +22 -11
- package/dist/src/cms/client/interfaces/components/ui/form/control-fields/control-fields.js +6 -1
- package/dist/src/cms/client/interfaces/pages/dashboard/content/content-management/_topicSlug_/page.js +2 -0
- package/dist/src/cms/client/interfaces/pages/dashboard/content/content-management/tag/page.js +4 -0
- package/dist/src/cms/client/interfaces/pages/dashboard/content/content-management/topic/page.js +4 -0
- package/dist/src/cms/client/interfaces/pages/dashboard/system/access/admin/_id_/edit/page.js +12 -11
- package/dist/src/cms/client/interfaces/pages/dashboard/system/access/admin/_id_/page.js +12 -11
- package/dist/src/cms/client/interfaces/pages/dashboard/system/access/admin/create/page.js +12 -11
- package/dist/src/cms/client/interfaces/pages/dashboard/system/storage/file/delete-many/page.js +36 -5
- package/dist/src/cms/client/interfaces/pages/dashboard/system/storage/trash/page.js +54 -5
- package/dist/src/cms/server/resources/file/actions.js +15 -31
- package/dist/src/config/author.js +13 -0
- package/dist/src/config/post.js +14 -0
- package/dist/src/core/infrastructure/prisma/admin/admin-prisma-ports.js +44 -28
- package/dist/src/core/infrastructure/prisma/config/config-prisma-ports.js +48 -31
- package/dist/src/core/infrastructure/prisma/file/file-prisma-ports.js +79 -34
- package/dist/src/core/infrastructure/prisma/file/include.js +32 -33
- package/dist/src/core/infrastructure/prisma/helpers/active-file-references.js +20 -0
- package/dist/src/core/infrastructure/prisma/post/post-prisma-ports.js +126 -95
- package/dist/src/core/sitero-server/create-sitero-server.js +1 -0
- package/dist/types/export/cms/client/components/index.d.ts +2 -1
- package/dist/types/export/cms/client/components/index.d.ts.map +1 -1
- package/dist/types/export/index.d.ts +1 -1
- package/dist/types/export/index.d.ts.map +1 -1
- package/dist/types/src/cms/client/infrastructure/i18n/messages/en-US/index.d.ts +45 -0
- package/dist/types/src/cms/client/infrastructure/i18n/messages/en-US/index.d.ts.map +1 -1
- package/dist/types/src/cms/client/infrastructure/i18n/messages/en-US/resources/file.d.ts +45 -0
- package/dist/types/src/cms/client/infrastructure/i18n/messages/en-US/resources/file.d.ts.map +1 -1
- package/dist/types/src/cms/client/infrastructure/i18n/messages/en-US/resources/index.d.ts +45 -0
- package/dist/types/src/cms/client/infrastructure/i18n/messages/en-US/resources/index.d.ts.map +1 -1
- package/dist/types/src/cms/client/infrastructure/i18n/messages/index.d.ts +90 -0
- package/dist/types/src/cms/client/infrastructure/i18n/messages/index.d.ts.map +1 -1
- package/dist/types/src/cms/client/infrastructure/i18n/messages/zh-TW/index.d.ts +45 -0
- package/dist/types/src/cms/client/infrastructure/i18n/messages/zh-TW/index.d.ts.map +1 -1
- package/dist/types/src/cms/client/infrastructure/i18n/messages/zh-TW/resources/file.d.ts +45 -0
- package/dist/types/src/cms/client/infrastructure/i18n/messages/zh-TW/resources/file.d.ts.map +1 -1
- package/dist/types/src/cms/client/infrastructure/i18n/messages/zh-TW/resources/index.d.ts +45 -0
- package/dist/types/src/cms/client/infrastructure/i18n/messages/zh-TW/resources/index.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/create-components.d.ts +2 -3
- package/dist/types/src/cms/client/interfaces/components/create-components.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/create-post-contents.d.ts +3 -1
- package/dist/types/src/cms/client/interfaces/components/create-post-contents.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/resources/admin/author-fields.d.ts +7 -0
- package/dist/types/src/cms/client/interfaces/components/resources/admin/author-fields.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/components/resources/admin/index.d.ts +1 -0
- package/dist/types/src/cms/client/interfaces/components/resources/admin/index.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/resources/file/file-card.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/resources/index.d.ts +1 -1
- package/dist/types/src/cms/client/interfaces/components/resources/index.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/resources/post/content/index.d.ts +1 -1
- package/dist/types/src/cms/client/interfaces/components/resources/post/content/index.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/resources/post/content/post-create-content.d.ts +5 -3
- package/dist/types/src/cms/client/interfaces/components/resources/post/content/post-create-content.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/resources/post/content/post-edit-content.d.ts +5 -3
- package/dist/types/src/cms/client/interfaces/components/resources/post/content/post-edit-content.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/resources/post/content/post-show-content.d.ts +5 -3
- package/dist/types/src/cms/client/interfaces/components/resources/post/content/post-show-content.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/resources/post/content/resolve-control-field-label.d.ts +3 -0
- package/dist/types/src/cms/client/interfaces/components/resources/post/content/resolve-control-field-label.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/components/resources/post/content/types.d.ts +9 -0
- package/dist/types/src/cms/client/interfaces/components/resources/post/content/types.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/resources/post/index.d.ts +1 -1
- package/dist/types/src/cms/client/interfaces/components/resources/post/index.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/resources/post/post-list.d.ts +5 -2
- package/dist/types/src/cms/client/interfaces/components/resources/post/post-list.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/resources/post/search/control-field-filter-state.d.ts +7 -0
- package/dist/types/src/cms/client/interfaces/components/resources/post/search/control-field-filter-state.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/components/resources/post/search/control-fields-filters.d.ts +4 -23
- package/dist/types/src/cms/client/interfaces/components/resources/post/search/control-fields-filters.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/ui/form/control-fields/control-fields-display.d.ts +2 -0
- package/dist/types/src/cms/client/interfaces/components/ui/form/control-fields/control-fields-display.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/ui/form/control-fields/control-fields-input.d.ts +2 -0
- package/dist/types/src/cms/client/interfaces/components/ui/form/control-fields/control-fields-input.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/ui/form/control-fields/control-fields.d.ts +2 -0
- package/dist/types/src/cms/client/interfaces/components/ui/form/control-fields/control-fields.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/[topicSlug]/page.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/tag/page.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/topic/page.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/pages/dashboard/system/access/admin/[id]/edit/page.d.ts +3 -2
- package/dist/types/src/cms/client/interfaces/pages/dashboard/system/access/admin/[id]/edit/page.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/pages/dashboard/system/access/admin/[id]/page.d.ts +3 -2
- package/dist/types/src/cms/client/interfaces/pages/dashboard/system/access/admin/[id]/page.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/pages/dashboard/system/access/admin/create/page.d.ts +3 -2
- package/dist/types/src/cms/client/interfaces/pages/dashboard/system/access/admin/create/page.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/pages/dashboard/system/storage/file/delete-many/page.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/pages/dashboard/system/storage/trash/page.d.ts.map +1 -1
- package/dist/types/src/cms/contracts/resources/file/actions.d.ts +16 -4
- package/dist/types/src/cms/contracts/resources/file/actions.d.ts.map +1 -1
- package/dist/types/src/cms/server/resources/file/actions.d.ts.map +1 -1
- package/dist/types/src/config/author.d.ts +4 -0
- package/dist/types/src/config/author.d.ts.map +1 -0
- package/dist/types/src/config/index.d.ts +2 -1
- package/dist/types/src/config/index.d.ts.map +1 -1
- package/dist/types/src/config/post.d.ts +3 -1
- package/dist/types/src/config/post.d.ts.map +1 -1
- package/dist/types/src/constants/cms-locale.d.ts +1 -0
- package/dist/types/src/constants/cms-locale.d.ts.map +1 -1
- package/dist/types/src/constants/index.d.ts +1 -1
- package/dist/types/src/constants/index.d.ts.map +1 -1
- package/dist/types/src/core/infrastructure/prisma/admin/admin-prisma-ports.d.ts.map +1 -1
- package/dist/types/src/core/infrastructure/prisma/config/config-prisma-ports.d.ts.map +1 -1
- package/dist/types/src/core/infrastructure/prisma/config/types.d.ts +1 -1
- package/dist/types/src/core/infrastructure/prisma/config/types.d.ts.map +1 -1
- package/dist/types/src/core/infrastructure/prisma/file/file-prisma-ports.d.ts +2 -1
- package/dist/types/src/core/infrastructure/prisma/file/file-prisma-ports.d.ts.map +1 -1
- package/dist/types/src/core/infrastructure/prisma/file/include.d.ts +32 -168
- package/dist/types/src/core/infrastructure/prisma/file/include.d.ts.map +1 -1
- package/dist/types/src/core/infrastructure/prisma/helpers/active-file-references.d.ts +9 -0
- package/dist/types/src/core/infrastructure/prisma/helpers/active-file-references.d.ts.map +1 -0
- package/dist/types/src/core/infrastructure/prisma/post/post-prisma-ports.d.ts.map +1 -1
- package/dist/types/src/core/sitero-server/create-sitero-server.d.ts.map +1 -1
- package/dist/types/src/web/server/resources/post/actions.d.ts +1 -1
- package/package.json +4 -3
package/dist/src/cms/client/interfaces/pages/dashboard/system/access/admin/_id_/edit/page.js
CHANGED
|
@@ -4,6 +4,7 @@ import { useTranslator } from 'intor/react';
|
|
|
4
4
|
import { ShieldUser } from 'lucide-react';
|
|
5
5
|
import { useParams, useRouter } from 'next/navigation';
|
|
6
6
|
import { ADMIN_ROLES } from 'sitero-domain';
|
|
7
|
+
import { AUTHOR_FIELDS } from '../../../../../../../../../../config/author.js';
|
|
7
8
|
import { CMS_PATHS } from '../../../../../../../../../../constants/paths/cms-paths.js';
|
|
8
9
|
import '../../../../../../../../../../constants/paths/redirect.js';
|
|
9
10
|
import { CMS_LOCALES_ARRAY } from '../../../../../../../../../../constants/cms-locale.js';
|
|
@@ -65,7 +66,7 @@ import 'intor/next';
|
|
|
65
66
|
import { ContentContainer } from '../../../../../../../components/ui/layouts/content-container.js';
|
|
66
67
|
|
|
67
68
|
function createAdminEditPage({
|
|
68
|
-
|
|
69
|
+
allowField = () => true,
|
|
69
70
|
webLocales,
|
|
70
71
|
useAdminUpdateFormData,
|
|
71
72
|
adminFindDetailAction,
|
|
@@ -254,13 +255,13 @@ function createAdminEditPage({
|
|
|
254
255
|
}
|
|
255
256
|
)
|
|
256
257
|
] }),
|
|
257
|
-
|
|
258
|
+
AUTHOR_FIELDS.some((field) => allowField({ field })) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
258
259
|
/* @__PURE__ */ jsxs("div", { className: "flex-center my-4 w-full gap-4", children: [
|
|
259
260
|
/* @__PURE__ */ jsx(Separator, { className: "flex-1" }),
|
|
260
261
|
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: t("resources.admin.author-info.text") }),
|
|
261
262
|
/* @__PURE__ */ jsx(Separator, { className: "flex-1" })
|
|
262
263
|
] }),
|
|
263
|
-
/* @__PURE__ */ jsx(
|
|
264
|
+
allowField({ field: "authorName" }) && /* @__PURE__ */ jsx(
|
|
264
265
|
I18nFormField,
|
|
265
266
|
{
|
|
266
267
|
fieldName: "authorName",
|
|
@@ -285,7 +286,7 @@ function createAdminEditPage({
|
|
|
285
286
|
)
|
|
286
287
|
}
|
|
287
288
|
),
|
|
288
|
-
/* @__PURE__ */ jsx(
|
|
289
|
+
allowField({ field: "socialLinks" }) && /* @__PURE__ */ jsx(
|
|
289
290
|
FormField,
|
|
290
291
|
{
|
|
291
292
|
controlId: "socialLinks",
|
|
@@ -308,7 +309,7 @@ function createAdminEditPage({
|
|
|
308
309
|
)
|
|
309
310
|
}
|
|
310
311
|
),
|
|
311
|
-
/* @__PURE__ */ jsx(
|
|
312
|
+
allowField({ field: "description" }) && /* @__PURE__ */ jsx(
|
|
312
313
|
I18nFormField,
|
|
313
314
|
{
|
|
314
315
|
fieldName: "description",
|
|
@@ -332,7 +333,7 @@ function createAdminEditPage({
|
|
|
332
333
|
)
|
|
333
334
|
}
|
|
334
335
|
),
|
|
335
|
-
/* @__PURE__ */ jsx(
|
|
336
|
+
allowField({ field: "jobTitle" }) && /* @__PURE__ */ jsx(
|
|
336
337
|
I18nFormField,
|
|
337
338
|
{
|
|
338
339
|
fieldName: "jobTitle",
|
|
@@ -357,7 +358,7 @@ function createAdminEditPage({
|
|
|
357
358
|
)
|
|
358
359
|
}
|
|
359
360
|
),
|
|
360
|
-
/* @__PURE__ */ jsx(
|
|
361
|
+
allowField({ field: "url" }) && /* @__PURE__ */ jsx(
|
|
361
362
|
I18nFormField,
|
|
362
363
|
{
|
|
363
364
|
fieldName: "url",
|
|
@@ -379,7 +380,7 @@ function createAdminEditPage({
|
|
|
379
380
|
)
|
|
380
381
|
}
|
|
381
382
|
),
|
|
382
|
-
/* @__PURE__ */ jsx(
|
|
383
|
+
allowField({ field: "worksFor" }) && /* @__PURE__ */ jsx(
|
|
383
384
|
I18nFormField,
|
|
384
385
|
{
|
|
385
386
|
fieldName: "worksFor",
|
|
@@ -404,7 +405,7 @@ function createAdminEditPage({
|
|
|
404
405
|
)
|
|
405
406
|
}
|
|
406
407
|
),
|
|
407
|
-
/* @__PURE__ */ jsx(
|
|
408
|
+
allowField({ field: "knowsAbout" }) && /* @__PURE__ */ jsx(
|
|
408
409
|
I18nFormField,
|
|
409
410
|
{
|
|
410
411
|
fieldName: "knowsAbout",
|
|
@@ -433,7 +434,7 @@ function createAdminEditPage({
|
|
|
433
434
|
)
|
|
434
435
|
}
|
|
435
436
|
),
|
|
436
|
-
/* @__PURE__ */ jsx(
|
|
437
|
+
allowField({ field: "homeLocation" }) && /* @__PURE__ */ jsx(
|
|
437
438
|
I18nFormField,
|
|
438
439
|
{
|
|
439
440
|
fieldName: "homeLocation",
|
|
@@ -458,7 +459,7 @@ function createAdminEditPage({
|
|
|
458
459
|
)
|
|
459
460
|
}
|
|
460
461
|
),
|
|
461
|
-
/* @__PURE__ */ jsx(
|
|
462
|
+
allowField({ field: "nationality" }) && /* @__PURE__ */ jsx(
|
|
462
463
|
I18nFormField,
|
|
463
464
|
{
|
|
464
465
|
fieldName: "nationality",
|
|
@@ -7,6 +7,7 @@ import { ADMIN_ROLES } from 'sitero-domain';
|
|
|
7
7
|
import 'zod';
|
|
8
8
|
import { useCmsCommand } from '../../../../../../../infrastructure/operation-result/use-cms-command.js';
|
|
9
9
|
import { useCmsQuery } from '../../../../../../../infrastructure/operation-result/use-cms-query.js';
|
|
10
|
+
import { AUTHOR_FIELDS } from '../../../../../../../../../config/author.js';
|
|
10
11
|
import { CMS_PATHS } from '../../../../../../../../../constants/paths/cms-paths.js';
|
|
11
12
|
import '../../../../../../../../../constants/paths/redirect.js';
|
|
12
13
|
import { DATE_FORMAT_OPTIONS } from '../../../../../../../../../constants/date.js';
|
|
@@ -61,7 +62,7 @@ import { ContentContainer } from '../../../../../../components/ui/layouts/conten
|
|
|
61
62
|
import { I18nDisplayField } from '../../../../../../components/ui/i18n/i18n-display-field.js';
|
|
62
63
|
|
|
63
64
|
function createAdminShowPage({
|
|
64
|
-
|
|
65
|
+
allowField = () => true,
|
|
65
66
|
webLocales,
|
|
66
67
|
adminFindDetailAction,
|
|
67
68
|
adminDeleteAction,
|
|
@@ -224,13 +225,13 @@ function createAdminShowPage({
|
|
|
224
225
|
}
|
|
225
226
|
) })
|
|
226
227
|
] }),
|
|
227
|
-
|
|
228
|
+
AUTHOR_FIELDS.some((field) => allowField({ field })) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
228
229
|
/* @__PURE__ */ jsxs("div", { className: "flex-center my-4 w-full gap-4", children: [
|
|
229
230
|
/* @__PURE__ */ jsx(Separator, { className: "flex-1" }),
|
|
230
231
|
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: t("resources.admin.author-info.text") }),
|
|
231
232
|
/* @__PURE__ */ jsx(Separator, { className: "flex-1" })
|
|
232
233
|
] }),
|
|
233
|
-
/* @__PURE__ */ jsx(
|
|
234
|
+
allowField({ field: "authorName" }) && /* @__PURE__ */ jsx(
|
|
234
235
|
I18nDisplayField,
|
|
235
236
|
{
|
|
236
237
|
fieldName: "authorName",
|
|
@@ -248,7 +249,7 @@ function createAdminShowPage({
|
|
|
248
249
|
)
|
|
249
250
|
}
|
|
250
251
|
),
|
|
251
|
-
/* @__PURE__ */ jsx(Field, { label: t("resources.admin.social-links.text"), children: /* @__PURE__ */ jsx(
|
|
252
|
+
allowField({ field: "socialLinks" }) && /* @__PURE__ */ jsx(Field, { label: t("resources.admin.social-links.text"), children: /* @__PURE__ */ jsx(
|
|
252
253
|
ArrayList,
|
|
253
254
|
{
|
|
254
255
|
isLink: true,
|
|
@@ -256,7 +257,7 @@ function createAdminShowPage({
|
|
|
256
257
|
isLoading: isFetching
|
|
257
258
|
}
|
|
258
259
|
) }),
|
|
259
|
-
/* @__PURE__ */ jsx(
|
|
260
|
+
allowField({ field: "description" }) && /* @__PURE__ */ jsx(
|
|
260
261
|
I18nDisplayField,
|
|
261
262
|
{
|
|
262
263
|
fieldName: "description",
|
|
@@ -274,7 +275,7 @@ function createAdminShowPage({
|
|
|
274
275
|
)
|
|
275
276
|
}
|
|
276
277
|
),
|
|
277
|
-
/* @__PURE__ */ jsx(
|
|
278
|
+
allowField({ field: "jobTitle" }) && /* @__PURE__ */ jsx(
|
|
278
279
|
I18nDisplayField,
|
|
279
280
|
{
|
|
280
281
|
fieldName: "jobTitle",
|
|
@@ -292,7 +293,7 @@ function createAdminShowPage({
|
|
|
292
293
|
)
|
|
293
294
|
}
|
|
294
295
|
),
|
|
295
|
-
/* @__PURE__ */ jsx(
|
|
296
|
+
allowField({ field: "url" }) && /* @__PURE__ */ jsx(
|
|
296
297
|
I18nDisplayField,
|
|
297
298
|
{
|
|
298
299
|
fieldName: "url",
|
|
@@ -310,7 +311,7 @@ function createAdminShowPage({
|
|
|
310
311
|
)
|
|
311
312
|
}
|
|
312
313
|
),
|
|
313
|
-
/* @__PURE__ */ jsx(
|
|
314
|
+
allowField({ field: "worksFor" }) && /* @__PURE__ */ jsx(
|
|
314
315
|
I18nDisplayField,
|
|
315
316
|
{
|
|
316
317
|
fieldName: "worksFor",
|
|
@@ -328,7 +329,7 @@ function createAdminShowPage({
|
|
|
328
329
|
)
|
|
329
330
|
}
|
|
330
331
|
),
|
|
331
|
-
/* @__PURE__ */ jsx(
|
|
332
|
+
allowField({ field: "knowsAbout" }) && /* @__PURE__ */ jsx(
|
|
332
333
|
I18nDisplayField,
|
|
333
334
|
{
|
|
334
335
|
fieldName: "knowsAbout",
|
|
@@ -344,7 +345,7 @@ function createAdminShowPage({
|
|
|
344
345
|
)
|
|
345
346
|
}
|
|
346
347
|
),
|
|
347
|
-
/* @__PURE__ */ jsx(
|
|
348
|
+
allowField({ field: "homeLocation" }) && /* @__PURE__ */ jsx(
|
|
348
349
|
I18nDisplayField,
|
|
349
350
|
{
|
|
350
351
|
fieldName: "homeLocation",
|
|
@@ -362,7 +363,7 @@ function createAdminShowPage({
|
|
|
362
363
|
)
|
|
363
364
|
}
|
|
364
365
|
),
|
|
365
|
-
/* @__PURE__ */ jsx(
|
|
366
|
+
allowField({ field: "nationality" }) && /* @__PURE__ */ jsx(
|
|
366
367
|
I18nDisplayField,
|
|
367
368
|
{
|
|
368
369
|
fieldName: "nationality",
|
|
@@ -4,6 +4,7 @@ import { useTranslator } from 'intor/react';
|
|
|
4
4
|
import { ShieldUser } from 'lucide-react';
|
|
5
5
|
import { useRouter } from 'next/navigation';
|
|
6
6
|
import { ADMIN_ROLE_ARRAY, ADMIN_ROLES } from 'sitero-domain';
|
|
7
|
+
import { AUTHOR_FIELDS } from '../../../../../../../../../config/author.js';
|
|
7
8
|
import { CMS_PATHS } from '../../../../../../../../../constants/paths/cms-paths.js';
|
|
8
9
|
import '../../../../../../../../../constants/paths/redirect.js';
|
|
9
10
|
import { CMS_LOCALES_ARRAY } from '../../../../../../../../../constants/cms-locale.js';
|
|
@@ -62,7 +63,7 @@ import 'intor/next';
|
|
|
62
63
|
import { ContentContainer } from '../../../../../../components/ui/layouts/content-container.js';
|
|
63
64
|
|
|
64
65
|
function createAdminCreatePage({
|
|
65
|
-
|
|
66
|
+
allowField = () => true,
|
|
66
67
|
webLocales,
|
|
67
68
|
useAdminCreateFormData,
|
|
68
69
|
adminCreateAction,
|
|
@@ -281,13 +282,13 @@ function createAdminCreatePage({
|
|
|
281
282
|
}
|
|
282
283
|
)
|
|
283
284
|
] }),
|
|
284
|
-
|
|
285
|
+
AUTHOR_FIELDS.some((field) => allowField({ field })) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
285
286
|
/* @__PURE__ */ jsxs("div", { className: "flex-center my-4 w-full gap-4", children: [
|
|
286
287
|
/* @__PURE__ */ jsx(Separator, { className: "flex-1" }),
|
|
287
288
|
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: t("resources.admin.author-info.text") }),
|
|
288
289
|
/* @__PURE__ */ jsx(Separator, { className: "flex-1" })
|
|
289
290
|
] }),
|
|
290
|
-
/* @__PURE__ */ jsx(
|
|
291
|
+
allowField({ field: "authorName" }) && /* @__PURE__ */ jsx(
|
|
291
292
|
I18nFormField,
|
|
292
293
|
{
|
|
293
294
|
fieldName: "authorName",
|
|
@@ -312,7 +313,7 @@ function createAdminCreatePage({
|
|
|
312
313
|
)
|
|
313
314
|
}
|
|
314
315
|
),
|
|
315
|
-
/* @__PURE__ */ jsx(
|
|
316
|
+
allowField({ field: "socialLinks" }) && /* @__PURE__ */ jsx(
|
|
316
317
|
FormField,
|
|
317
318
|
{
|
|
318
319
|
controlId: "socialLinks",
|
|
@@ -335,7 +336,7 @@ function createAdminCreatePage({
|
|
|
335
336
|
)
|
|
336
337
|
}
|
|
337
338
|
),
|
|
338
|
-
/* @__PURE__ */ jsx(
|
|
339
|
+
allowField({ field: "description" }) && /* @__PURE__ */ jsx(
|
|
339
340
|
I18nFormField,
|
|
340
341
|
{
|
|
341
342
|
fieldName: "description",
|
|
@@ -359,7 +360,7 @@ function createAdminCreatePage({
|
|
|
359
360
|
)
|
|
360
361
|
}
|
|
361
362
|
),
|
|
362
|
-
/* @__PURE__ */ jsx(
|
|
363
|
+
allowField({ field: "jobTitle" }) && /* @__PURE__ */ jsx(
|
|
363
364
|
I18nFormField,
|
|
364
365
|
{
|
|
365
366
|
fieldName: "jobTitle",
|
|
@@ -384,7 +385,7 @@ function createAdminCreatePage({
|
|
|
384
385
|
)
|
|
385
386
|
}
|
|
386
387
|
),
|
|
387
|
-
/* @__PURE__ */ jsx(
|
|
388
|
+
allowField({ field: "url" }) && /* @__PURE__ */ jsx(
|
|
388
389
|
I18nFormField,
|
|
389
390
|
{
|
|
390
391
|
fieldName: "url",
|
|
@@ -406,7 +407,7 @@ function createAdminCreatePage({
|
|
|
406
407
|
)
|
|
407
408
|
}
|
|
408
409
|
),
|
|
409
|
-
/* @__PURE__ */ jsx(
|
|
410
|
+
allowField({ field: "worksFor" }) && /* @__PURE__ */ jsx(
|
|
410
411
|
I18nFormField,
|
|
411
412
|
{
|
|
412
413
|
fieldName: "worksFor",
|
|
@@ -431,7 +432,7 @@ function createAdminCreatePage({
|
|
|
431
432
|
)
|
|
432
433
|
}
|
|
433
434
|
),
|
|
434
|
-
/* @__PURE__ */ jsx(
|
|
435
|
+
allowField({ field: "knowsAbout" }) && /* @__PURE__ */ jsx(
|
|
435
436
|
I18nFormField,
|
|
436
437
|
{
|
|
437
438
|
fieldName: "knowsAbout",
|
|
@@ -460,7 +461,7 @@ function createAdminCreatePage({
|
|
|
460
461
|
)
|
|
461
462
|
}
|
|
462
463
|
),
|
|
463
|
-
/* @__PURE__ */ jsx(
|
|
464
|
+
allowField({ field: "homeLocation" }) && /* @__PURE__ */ jsx(
|
|
464
465
|
I18nFormField,
|
|
465
466
|
{
|
|
466
467
|
fieldName: "homeLocation",
|
|
@@ -485,7 +486,7 @@ function createAdminCreatePage({
|
|
|
485
486
|
)
|
|
486
487
|
}
|
|
487
488
|
),
|
|
488
|
-
/* @__PURE__ */ jsx(
|
|
489
|
+
allowField({ field: "nationality" }) && /* @__PURE__ */ jsx(
|
|
489
490
|
I18nFormField,
|
|
490
491
|
{
|
|
491
492
|
fieldName: "nationality",
|
package/dist/src/cms/client/interfaces/pages/dashboard/system/storage/file/delete-many/page.js
CHANGED
|
@@ -64,13 +64,44 @@ function createFileDeleteManyPage({
|
|
|
64
64
|
formData: { ids: pickedItems.map((i) => i.id) }
|
|
65
65
|
}),
|
|
66
66
|
{
|
|
67
|
-
onSuccess: () => {
|
|
68
|
-
|
|
67
|
+
onSuccess: (result) => {
|
|
68
|
+
if (!result) return;
|
|
69
|
+
setPickedItems(
|
|
70
|
+
(items) => items.filter(
|
|
71
|
+
(item) => result.failed.some((failure) => failure.id === item.id)
|
|
72
|
+
)
|
|
73
|
+
);
|
|
74
|
+
if (result.failed.length || result.skipped.length) {
|
|
75
|
+
const skippedMessages = {
|
|
76
|
+
FILE_NOT_FOUND: t("resources.file.delete-not-found.text"),
|
|
77
|
+
FILE_DELETE_ALREADY_DELETED: t(
|
|
78
|
+
"resources.file.delete-already-deleted.text"
|
|
79
|
+
),
|
|
80
|
+
FILE_DELETE_LOCKED: t("resources.file.file-locked-warning.text"),
|
|
81
|
+
FILE_DELETE_IN_USE: t("resources.file.file-in-use-warning.text")
|
|
82
|
+
};
|
|
83
|
+
const reasons = [
|
|
84
|
+
...new Set(
|
|
85
|
+
result.skipped.map((item) => skippedMessages[item.code])
|
|
86
|
+
)
|
|
87
|
+
];
|
|
88
|
+
toast.warning(
|
|
89
|
+
[
|
|
90
|
+
result.deletedIds.length > 0 && `${t("resources.file.delete-completed.text")}: ${result.deletedIds.length}`,
|
|
91
|
+
result.skipped.length > 0 && `${t("resources.file.delete-skipped.text")}: ${result.skipped.length}`,
|
|
92
|
+
result.failed.length > 0 && `${t("resources.file.delete-failed.text")}: ${result.failed.length}`,
|
|
93
|
+
...reasons
|
|
94
|
+
].filter(Boolean).join(" \xB7 ")
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
onSettled: () => {
|
|
69
99
|
void itemStates.refetch?.();
|
|
70
100
|
}
|
|
71
101
|
}
|
|
72
102
|
);
|
|
73
103
|
const handleClick = (file) => {
|
|
104
|
+
if (isPending) return;
|
|
74
105
|
if (file.isLocked || file.isInUse) {
|
|
75
106
|
toast.error(
|
|
76
107
|
t(
|
|
@@ -99,7 +130,7 @@ function createFileDeleteManyPage({
|
|
|
99
130
|
variant: "outline",
|
|
100
131
|
icon: CopyCheck,
|
|
101
132
|
onClick: pickAll,
|
|
102
|
-
isDisabled: !canPickAll
|
|
133
|
+
isDisabled: isPending || !canPickAll
|
|
103
134
|
}
|
|
104
135
|
),
|
|
105
136
|
/* @__PURE__ */ jsx(
|
|
@@ -109,7 +140,7 @@ function createFileDeleteManyPage({
|
|
|
109
140
|
variant: "outline",
|
|
110
141
|
icon: CopyX,
|
|
111
142
|
onClick: cancelAll,
|
|
112
|
-
isDisabled: !canCancelAll
|
|
143
|
+
isDisabled: isPending || !canCancelAll
|
|
113
144
|
}
|
|
114
145
|
),
|
|
115
146
|
/* @__PURE__ */ jsx(
|
|
@@ -122,7 +153,7 @@ function createFileDeleteManyPage({
|
|
|
122
153
|
void execute();
|
|
123
154
|
},
|
|
124
155
|
isLoading: isPending,
|
|
125
|
-
isDisabled: pickedItems.length === 0,
|
|
156
|
+
isDisabled: isPending || pickedItems.length === 0,
|
|
126
157
|
children: t("ui.destroy.text")
|
|
127
158
|
}
|
|
128
159
|
)
|
|
@@ -65,8 +65,38 @@ function createTrashPage({
|
|
|
65
65
|
formData: { ids: pickedItems.map((i) => i.id) }
|
|
66
66
|
}),
|
|
67
67
|
{
|
|
68
|
-
onSuccess: () => {
|
|
69
|
-
|
|
68
|
+
onSuccess: (result) => {
|
|
69
|
+
if (!result) return;
|
|
70
|
+
setPickedItems(
|
|
71
|
+
(items) => items.filter(
|
|
72
|
+
(item) => result.failed.some((failure) => failure.id === item.id)
|
|
73
|
+
)
|
|
74
|
+
);
|
|
75
|
+
if (result.failed.length || result.skipped.length) {
|
|
76
|
+
const skippedMessages = {
|
|
77
|
+
FILE_NOT_FOUND: t("resources.file.restore-not-found.text"),
|
|
78
|
+
FILE_RESTORE_NOT_DELETED: t(
|
|
79
|
+
"resources.file.restore-not-deleted.text"
|
|
80
|
+
),
|
|
81
|
+
FILE_RESTORE_PURGE_STARTED: t(
|
|
82
|
+
"resources.file.restore-purge-started.text"
|
|
83
|
+
)
|
|
84
|
+
};
|
|
85
|
+
const reasons = [
|
|
86
|
+
...new Set(
|
|
87
|
+
result.skipped.map((item) => skippedMessages[item.code])
|
|
88
|
+
)
|
|
89
|
+
];
|
|
90
|
+
const message = [
|
|
91
|
+
result.restoredIds.length > 0 && `${t("resources.file.restore-completed.text")}: ${result.restoredIds.length}`,
|
|
92
|
+
result.skipped.length > 0 && `${t("resources.file.restore-skipped.text")}: ${result.skipped.length}`,
|
|
93
|
+
result.failed.length > 0 && `${t("resources.file.restore-failed.text")}: ${result.failed.length}`,
|
|
94
|
+
...reasons
|
|
95
|
+
].filter(Boolean).join(" \xB7 ");
|
|
96
|
+
toast.warning(message);
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
onSettled: () => {
|
|
70
100
|
void itemStates.refetch?.();
|
|
71
101
|
}
|
|
72
102
|
}
|
|
@@ -76,8 +106,23 @@ function createTrashPage({
|
|
|
76
106
|
formData: { ids: pickedItems.map((i) => i.id) }
|
|
77
107
|
}),
|
|
78
108
|
{
|
|
79
|
-
onSuccess: () => {
|
|
80
|
-
|
|
109
|
+
onSuccess: (result) => {
|
|
110
|
+
if (!result) return;
|
|
111
|
+
setPickedItems(
|
|
112
|
+
(items) => items.filter(
|
|
113
|
+
(item) => result.failed.some((failure) => failure.id === item.id)
|
|
114
|
+
)
|
|
115
|
+
);
|
|
116
|
+
if (result.failed.length || result.skipped.length) {
|
|
117
|
+
const message = [
|
|
118
|
+
result.purgedIds.length > 0 && `${t("resources.file.purge-completed.text")}: ${result.purgedIds.length}`,
|
|
119
|
+
result.skipped.length > 0 && `${t("resources.file.purge-skipped.text")}: ${result.skipped.length}`,
|
|
120
|
+
result.failed.length > 0 && `${t("resources.file.purge-failed.text")}: ${result.failed.length}`
|
|
121
|
+
].filter(Boolean).join(" \xB7 ");
|
|
122
|
+
toast.warning(message);
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
onSettled: () => {
|
|
81
126
|
void itemStates.refetch?.();
|
|
82
127
|
}
|
|
83
128
|
}
|
|
@@ -135,7 +180,11 @@ function createTrashPage({
|
|
|
135
180
|
void restoreFn();
|
|
136
181
|
},
|
|
137
182
|
isLoading: isRestoring,
|
|
138
|
-
isDisabled: isProcessing || pickedItems.length === 0
|
|
183
|
+
isDisabled: isProcessing || pickedItems.length === 0 || pickedItems.some(
|
|
184
|
+
(item) => files.some(
|
|
185
|
+
(file) => file.id === item.id && !!file.purgeStartedAt
|
|
186
|
+
)
|
|
187
|
+
),
|
|
139
188
|
children: t("ui.restore.text")
|
|
140
189
|
}
|
|
141
190
|
),
|
|
@@ -32,12 +32,6 @@ function toFileUpdateInput(input) {
|
|
|
32
32
|
translations: input.formData.translations
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
function hasBatchMutationFailure(input) {
|
|
36
|
-
return input.failed.length > 0 && input.completed.length === 0;
|
|
37
|
-
}
|
|
38
|
-
function getFirstSkippedCode(input) {
|
|
39
|
-
return input[0]?.code ?? "INTERNAL_ERROR";
|
|
40
|
-
}
|
|
41
35
|
function createFileActions({
|
|
42
36
|
resolveExecutionContext,
|
|
43
37
|
siteroServer
|
|
@@ -120,15 +114,11 @@ function createFileActions({
|
|
|
120
114
|
contextResult.data
|
|
121
115
|
);
|
|
122
116
|
if (!result.success) return result;
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
code: result.data.skipped.length > 0 ? getFirstSkippedCode(result.data.skipped) : "INTERNAL_ERROR"
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
return operationResult.success(void 0);
|
|
117
|
+
return operationResult.success({
|
|
118
|
+
deletedIds: result.data.deleted.map((file) => file.id),
|
|
119
|
+
skipped: result.data.skipped,
|
|
120
|
+
failed: result.data.failed
|
|
121
|
+
});
|
|
132
122
|
};
|
|
133
123
|
const fileRestoreManyAction = async (input) => {
|
|
134
124
|
const contextResult = await resolveExecutionContext();
|
|
@@ -139,13 +129,11 @@ function createFileActions({
|
|
|
139
129
|
contextResult.data
|
|
140
130
|
);
|
|
141
131
|
if (!result.success) return result;
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
return operationResult.success(void 0);
|
|
132
|
+
return operationResult.success({
|
|
133
|
+
restoredIds: result.data.restored.map((file) => file.id),
|
|
134
|
+
skipped: result.data.skipped,
|
|
135
|
+
failed: result.data.failed
|
|
136
|
+
});
|
|
149
137
|
};
|
|
150
138
|
const filePurgeManyAction = async (input) => {
|
|
151
139
|
const contextResult = await resolveExecutionContext();
|
|
@@ -156,15 +144,11 @@ function createFileActions({
|
|
|
156
144
|
contextResult.data
|
|
157
145
|
);
|
|
158
146
|
if (!result.success) return result;
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
code: result.data.skipped.length > 0 ? getFirstSkippedCode(result.data.skipped) : "INTERNAL_ERROR"
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
return operationResult.success(void 0);
|
|
147
|
+
return operationResult.success({
|
|
148
|
+
purgedIds: result.data.purged.map((file) => file.id),
|
|
149
|
+
skipped: result.data.skipped,
|
|
150
|
+
failed: result.data.failed
|
|
151
|
+
});
|
|
168
152
|
};
|
|
169
153
|
const fileFindDetailAction = async (input) => {
|
|
170
154
|
const contextResult = await resolveExecutionContext();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ADMIN_ROLES } from 'sitero-domain';
|
|
2
|
+
import { withActiveFileReferences } from '../helpers/active-file-references.js';
|
|
2
3
|
import { connectOrDisconnectOne, connectOne } from '../helpers/relation-writes.js';
|
|
3
4
|
import { createSearchWhere } from '../helpers/search-where.js';
|
|
4
5
|
import { adminToSafe } from './base-mappers.js';
|
|
@@ -30,37 +31,52 @@ function createAdminPrismaPorts(prisma) {
|
|
|
30
31
|
// ------------------------------------------------------------
|
|
31
32
|
adminCommandPort: {
|
|
32
33
|
async create(input) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
data
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
return withActiveFileReferences(
|
|
35
|
+
prisma,
|
|
36
|
+
[input.avatarImage],
|
|
37
|
+
async (transaction) => {
|
|
38
|
+
const { avatarImage, translations, ...data } = input;
|
|
39
|
+
const avatarImageWrite = connectOne(avatarImage);
|
|
40
|
+
return adminToSafe(
|
|
41
|
+
await transaction.admin.create({
|
|
42
|
+
data: {
|
|
43
|
+
...data,
|
|
44
|
+
...avatarImageWrite ? { avatarImage: avatarImageWrite } : {},
|
|
45
|
+
translations: { create: translations }
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
);
|
|
49
|
+
}
|
|
43
50
|
);
|
|
44
51
|
},
|
|
45
52
|
async update(input) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
data
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
53
|
+
return withActiveFileReferences(
|
|
54
|
+
prisma,
|
|
55
|
+
[input.avatarImage],
|
|
56
|
+
async (transaction) => {
|
|
57
|
+
const { id, avatarImage, translations, ...data } = input;
|
|
58
|
+
return adminToSafe(
|
|
59
|
+
await transaction.admin.update({
|
|
60
|
+
where: { id },
|
|
61
|
+
data: {
|
|
62
|
+
...data,
|
|
63
|
+
avatarImage: connectOrDisconnectOne(avatarImage),
|
|
64
|
+
translations: {
|
|
65
|
+
upsert: translations.map((translation) => ({
|
|
66
|
+
where: {
|
|
67
|
+
adminId_locale: {
|
|
68
|
+
adminId: id,
|
|
69
|
+
locale: translation.locale
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
update: translation,
|
|
73
|
+
create: translation
|
|
74
|
+
}))
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
);
|
|
79
|
+
}
|
|
64
80
|
);
|
|
65
81
|
},
|
|
66
82
|
async delete({ id }) {
|