openadminjs 0.1.7 → 0.1.9
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 +114 -18
- package/dist/create-project.js +27 -4
- package/dist/create-project.test.js +57 -41
- package/dist/index.js +16 -5
- package/package.json +4 -2
- package/template/.env.example +2 -2
- package/template/README.md +24 -5
- package/template/apps/admin/app/api/auth/login/route.ts +51 -0
- package/template/apps/admin/app/api/auth/logout/route.ts +11 -0
- package/template/apps/admin/app/api/auth/refresh/route.ts +46 -0
- package/template/apps/admin/app/api-tokens/page.tsx +253 -0
- package/template/apps/admin/app/audit-logs/page.tsx +5 -0
- package/template/apps/admin/app/dashboard/page.tsx +392 -0
- package/template/apps/admin/app/files/page.tsx +5 -0
- package/template/apps/admin/app/globals.css +206 -0
- package/template/apps/admin/app/jobs/page.tsx +19 -0
- package/template/apps/admin/app/layout.tsx +57 -0
- package/template/apps/admin/app/login/page.test.tsx +18 -0
- package/template/apps/admin/app/login/page.tsx +161 -0
- package/template/apps/admin/app/login/safe-next-param.ts +4 -0
- package/template/apps/admin/app/notifications/page.tsx +146 -0
- package/template/apps/admin/app/page.tsx +5 -0
- package/template/apps/admin/app/plugins/page.tsx +407 -0
- package/template/apps/admin/app/profile/page.tsx +116 -0
- package/template/apps/admin/app/resources/[resource]/[id]/edit/page.tsx +45 -0
- package/template/apps/admin/app/resources/[resource]/[id]/page.tsx +449 -0
- package/template/apps/admin/app/resources/[resource]/create/page.tsx +34 -0
- package/template/apps/admin/app/resources/[resource]/page.tsx +100 -0
- package/template/apps/admin/app/settings/page.tsx +233 -0
- package/template/apps/admin/components/ai-assistant-widget.tsx +684 -0
- package/template/apps/admin/components/app-shell.tsx +305 -0
- package/template/apps/admin/components/auth-guard.test.tsx +55 -0
- package/template/apps/admin/components/auth-guard.tsx +39 -0
- package/template/apps/admin/components/jobs-panel.tsx +103 -0
- package/template/apps/admin/components/logo.tsx +30 -0
- package/template/apps/admin/components/resource-form.tsx +349 -0
- package/template/apps/admin/components/resource-table.tsx +277 -0
- package/template/apps/admin/lib/ai-events.ts +23 -0
- package/template/apps/admin/lib/api.test.ts +118 -0
- package/template/apps/admin/lib/api.ts +135 -0
- package/template/apps/admin/lib/auth-flow.e2e.test.ts +79 -0
- package/template/apps/admin/lib/brand.ts +14 -0
- package/template/apps/admin/lib/locale.ts +49 -0
- package/template/apps/admin/lib/tokens.ts +93 -0
- package/template/apps/admin/middleware.ts +58 -0
- package/template/apps/admin/next-env.d.ts +6 -0
- package/template/apps/admin/next.config.mjs +7 -0
- package/template/apps/admin/package.json +44 -0
- package/template/apps/admin/postcss.config.mjs +6 -0
- package/template/apps/admin/public/brand/apple-touch-icon.png +0 -0
- package/template/apps/admin/public/brand/favicon.svg +1 -0
- package/template/apps/admin/public/brand/og-image.png +0 -0
- package/template/apps/admin/public/brand/openadminjs-icon-new.png +0 -0
- package/template/apps/admin/public/brand/openadminjs-logo-monochrome.png +0 -0
- package/template/apps/admin/public/brand/openadminjs-logo-new.png +0 -0
- package/template/apps/admin/tailwind.config.ts +37 -0
- package/template/apps/admin/tsconfig.json +23 -0
- package/template/apps/admin/vitest.config.ts +7 -0
- package/template/apps/api/package.json +56 -0
- package/template/apps/api/plugins.manifest.example.json +34 -0
- package/template/apps/api/plugins.manifest.json +4 -0
- package/template/apps/api/src/access/catalog.ts +112 -0
- package/template/apps/api/src/access/derive-permissions.test.ts +26 -0
- package/template/apps/api/src/access/derive-permissions.ts +36 -0
- package/template/apps/api/src/access/public-catalog.ts +28 -0
- package/template/apps/api/src/admin/admin-ai.controller.ts +125 -0
- package/template/apps/api/src/admin/admin-ai.events.ts +23 -0
- package/template/apps/api/src/admin/admin-ai.service.ts +1271 -0
- package/template/apps/api/src/admin/admin-analytics.service.ts +164 -0
- package/template/apps/api/src/admin/admin-plugins.controller.ts +32 -0
- package/template/apps/api/src/admin/admin-plugins.service.ts +267 -0
- package/template/apps/api/src/admin/admin-resource.service.test.ts +118 -0
- package/template/apps/api/src/admin/admin-resource.service.ts +375 -0
- package/template/apps/api/src/admin/admin.controller.ts +72 -0
- package/template/apps/api/src/admin/admin.module.ts +30 -0
- package/template/apps/api/src/admin/dto/plugins.dto.ts +55 -0
- package/template/apps/api/src/admin/validate-resource-payload.test.ts +44 -0
- package/template/apps/api/src/admin/validate-resource-payload.ts +103 -0
- package/template/apps/api/src/app.module.ts +45 -0
- package/template/apps/api/src/auth/auth.controller.ts +70 -0
- package/template/apps/api/src/auth/auth.dto.ts +49 -0
- package/template/apps/api/src/auth/auth.module.ts +30 -0
- package/template/apps/api/src/auth/auth.service.test.ts +75 -0
- package/template/apps/api/src/auth/auth.service.ts +231 -0
- package/template/apps/api/src/common/auth-realm.decorator.ts +6 -0
- package/template/apps/api/src/common/auth.guard.test.ts +61 -0
- package/template/apps/api/src/common/auth.guard.ts +78 -0
- package/template/apps/api/src/common/casl-ability.factory.test.ts +33 -0
- package/template/apps/api/src/common/casl-ability.factory.ts +41 -0
- package/template/apps/api/src/common/current-user.decorator.ts +6 -0
- package/template/apps/api/src/common/permission.decorator.ts +7 -0
- package/template/apps/api/src/common/permissions.guard.ts +31 -0
- package/template/apps/api/src/common/prisma.service.ts +13 -0
- package/template/apps/api/src/health/health.controller.ts +25 -0
- package/template/apps/api/src/mail/mail.module.ts +9 -0
- package/template/apps/api/src/mail/mail.service.ts +115 -0
- package/template/apps/api/src/main.ts +37 -0
- package/template/apps/api/src/plugins/bootstrap.ts +4 -0
- package/template/apps/api/src/plugins/bundled/admin-widget.plugin.ts +25 -0
- package/template/apps/api/src/plugins/bundled/hello.plugin.ts +19 -0
- package/template/apps/api/src/plugins/bundled/image-optimizer.plugin.ts +22 -0
- package/template/apps/api/src/plugins/bundled/registry.ts +13 -0
- package/template/apps/api/src/plugins/bundled/seo.plugin.ts +25 -0
- package/template/apps/api/src/plugins/manifest-path.ts +35 -0
- package/template/apps/api/src/plugins/manifest.schema.test.ts +36 -0
- package/template/apps/api/src/plugins/manifest.schema.ts +58 -0
- package/template/apps/api/src/plugins/plugin-api.interceptor.ts +47 -0
- package/template/apps/api/src/plugins/plugin-loader.ts +134 -0
- package/template/apps/api/src/plugins/plugin-runtime.test.ts +24 -0
- package/template/apps/api/src/plugins/plugin-runtime.ts +85 -0
- package/template/apps/api/src/queue/queue.controller.ts +28 -0
- package/template/apps/api/src/queue/queue.module.ts +23 -0
- package/template/apps/api/src/queue/queue.processor.ts +47 -0
- package/template/apps/api/src/queue/queue.service.ts +50 -0
- package/template/apps/api/src/resources/categories.resource.ts +21 -0
- package/template/apps/api/src/resources/commerce.resource.ts +157 -0
- package/template/apps/api/src/resources/operations.resource.ts +111 -0
- package/template/apps/api/src/resources/posts.resource.ts +88 -0
- package/template/apps/api/src/resources/registry.ts +27 -0
- package/template/apps/api/src/resources/resource-hooks.install.ts +18 -0
- package/template/apps/api/src/resources/resource-hooks.registry.test.ts +72 -0
- package/template/apps/api/src/resources/resource-hooks.registry.ts +66 -0
- package/template/apps/api/src/resources/resource-hooks.runner.ts +93 -0
- package/template/apps/api/src/resources/system.resource.ts +51 -0
- package/template/apps/api/src/resources/users.resource.ts +19 -0
- package/template/apps/api/src/store/payment/payment.controller.ts +98 -0
- package/template/apps/api/src/store/payment/payment.module.ts +14 -0
- package/template/apps/api/src/store/payment/payment.provider.ts +38 -0
- package/template/apps/api/src/store/payment/payment.service.ts +235 -0
- package/template/apps/api/src/store/store.controller.ts +26 -0
- package/template/apps/api/src/store/store.module.ts +12 -0
- package/template/apps/api/src/test-setup.ts +1 -0
- package/template/apps/api/tsconfig.json +11 -0
- package/template/apps/api/vitest.config.ts +21 -0
- package/template/apps/web/lib/openadmin-client.ts +11 -0
- package/template/apps/web/lib/seo.test.ts +41 -0
- package/template/apps/web/lib/seo.ts +24 -13
- package/template/apps/web/next-env.d.ts +4 -0
- package/template/apps/web/package.json +2 -1
- package/template/apps/web/test/next-stub.ts +7 -0
- package/template/apps/web/vitest.config.ts +19 -0
- package/template/package.json +18 -11
- package/template/packages/auth/package.json +17 -0
- package/template/packages/auth/src/index.test.ts +10 -0
- package/template/packages/auth/src/index.ts +17 -0
- package/template/packages/auth/tsconfig.json +8 -0
- package/template/packages/brand/apps/admin/public/brand/apple-touch-icon.png +0 -0
- package/template/packages/brand/apps/admin/public/brand/favicon.svg +1 -0
- package/template/packages/brand/apps/admin/public/brand/og-image.png +0 -0
- package/template/packages/brand/apps/admin/public/brand/openadminjs-icon-new.png +0 -0
- package/template/packages/brand/apps/admin/public/brand/openadminjs-logo-monochrome.png +0 -0
- package/template/packages/brand/apps/admin/public/brand/openadminjs-logo-new.png +0 -0
- package/template/packages/brand/apps/web/public/brand/apple-touch-icon.png +0 -0
- package/template/packages/brand/apps/web/public/brand/favicon.svg +1 -0
- package/template/packages/brand/apps/web/public/brand/og-image.png +0 -0
- package/template/packages/brand/apps/web/public/brand/openadminjs-icon-new.png +0 -0
- package/template/packages/brand/apps/web/public/brand/openadminjs-logo-monochrome.png +0 -0
- package/template/packages/brand/apps/web/public/brand/openadminjs-logo-new.png +0 -0
- package/template/packages/brand/package.json +19 -0
- package/template/packages/brand/site/assets/brand/favicon.svg +1 -0
- package/template/packages/brand/site/assets/brand/og-image.svg +1 -0
- package/template/packages/brand/site/assets/brand/openadminjs-icon.svg +1 -0
- package/template/packages/brand/site/assets/brand/openadminjs-logo-dark.svg +1 -0
- package/template/packages/brand/site/assets/brand/openadminjs-logo-horizontal.svg +1 -0
- package/template/packages/brand/site/assets/brand/openadminjs-logo-monochrome.svg +1 -0
- package/template/packages/brand/site/assets/brand/openadminjs-logo.svg +1 -0
- package/template/packages/brand/src/generate-assets.mjs +182 -0
- package/template/packages/brand/src/index.test.ts +9 -0
- package/template/packages/brand/src/index.ts +7 -0
- package/template/packages/brand/tsconfig.json +7 -0
- package/template/packages/core/package.json +20 -0
- package/template/packages/core/src/index.js +1 -0
- package/template/packages/core/src/index.test.ts +27 -0
- package/template/packages/core/src/index.ts +61 -0
- package/template/packages/core/tsconfig.json +8 -0
- package/template/packages/mail/package.json +18 -0
- package/template/packages/mail/src/index.test.ts +23 -0
- package/template/packages/mail/src/index.ts +246 -0
- package/template/packages/mail/tsconfig.json +5 -0
- package/template/packages/notifications/package.json +16 -0
- package/template/packages/notifications/src/index.test.ts +9 -0
- package/template/packages/notifications/src/index.ts +5 -0
- package/template/packages/notifications/tsconfig.json +5 -0
- package/template/packages/payments/package.json +15 -0
- package/template/packages/payments/src/index.ts +256 -0
- package/template/packages/payments/tsconfig.json +9 -0
- package/template/packages/permissions/package.json +17 -0
- package/template/packages/permissions/src/blueprints.js +57 -0
- package/template/packages/permissions/src/blueprints.test.ts +62 -0
- package/template/packages/permissions/src/blueprints.ts +89 -0
- package/template/packages/permissions/src/index.js +11 -0
- package/template/packages/permissions/src/index.test.ts +34 -0
- package/template/packages/permissions/src/index.ts +22 -0
- package/template/packages/permissions/tsconfig.json +8 -0
- package/template/packages/plugin-sdk/package.json +26 -0
- package/template/packages/plugin-sdk/src/hooks.ts +135 -0
- package/template/packages/plugin-sdk/src/index.ts +42 -0
- package/template/packages/plugin-sdk/src/sdk.test.ts +13 -0
- package/template/packages/plugin-sdk/tsconfig.json +8 -0
- package/template/packages/plugin-sdk/vitest.config.ts +5 -0
- package/template/packages/queue/package.json +16 -0
- package/template/packages/queue/src/index.test.ts +12 -0
- package/template/packages/queue/src/index.ts +6 -0
- package/template/packages/queue/tsconfig.json +5 -0
- package/template/packages/resource/package.json +17 -0
- package/template/packages/resource/src/index.js +177 -0
- package/template/packages/resource/src/index.test.ts +151 -0
- package/template/packages/resource/src/index.ts +344 -0
- package/template/packages/resource/tsconfig.json +8 -0
- package/template/packages/storage/package.json +16 -0
- package/template/packages/storage/src/index.test.ts +10 -0
- package/template/packages/storage/src/index.ts +23 -0
- package/template/packages/storage/tsconfig.json +5 -0
- package/template/prisma/migrations/20260505151751_baseline_init_all_tables/migration.sql +371 -0
- package/template/prisma/migrations/migration_lock.toml +3 -0
- package/template/prisma/schema.prisma +291 -0
- package/template/prisma/seed.ts +217 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type { PrismaClient } from "@prisma/client";
|
|
2
|
+
import { defineResource } from "@openadminjs/core";
|
|
3
|
+
|
|
4
|
+
export const apiTokensResource = defineResource({
|
|
5
|
+
name: "api-tokens",
|
|
6
|
+
label: { en: "API tokens", ru: "API-токены" },
|
|
7
|
+
model: "apiToken",
|
|
8
|
+
titleField: "name",
|
|
9
|
+
icon: "KeyRound",
|
|
10
|
+
i18n: { defaultLocale: "en", locales: ["en", "ru"] },
|
|
11
|
+
permissions: {
|
|
12
|
+
read: "api-tokens.read",
|
|
13
|
+
create: "api-tokens.create",
|
|
14
|
+
delete: "api-tokens.delete",
|
|
15
|
+
revoke: "api-tokens.revoke"
|
|
16
|
+
},
|
|
17
|
+
fields: {
|
|
18
|
+
id: { type: "id", label: "ID", create: false, edit: false, list: false },
|
|
19
|
+
name: { type: "text", label: { en: "Name", ru: "Имя" }, searchable: true },
|
|
20
|
+
scopes: { type: "json", label: "Scopes", create: true, edit: false },
|
|
21
|
+
tokenHash: { type: "hidden", label: "Token hash" },
|
|
22
|
+
revokedAt: { type: "datetime", label: { en: "Revoked at", ru: "Отозван" }, create: false, edit: false },
|
|
23
|
+
createdAt: { type: "datetime", label: { en: "Created", ru: "Создан" }, create: false, edit: false, sortable: true }
|
|
24
|
+
},
|
|
25
|
+
actions: {
|
|
26
|
+
revoke: {
|
|
27
|
+
label: { en: "Revoke", ru: "Отозвать" },
|
|
28
|
+
variant: "destructive",
|
|
29
|
+
confirm: true,
|
|
30
|
+
permission: "api-tokens.revoke",
|
|
31
|
+
async handler(ctx) {
|
|
32
|
+
const db = ctx.prisma as PrismaClient;
|
|
33
|
+
return db.apiToken.update({
|
|
34
|
+
where: { id: ctx.id },
|
|
35
|
+
data: { revokedAt: new Date() }
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export const notificationsResource = defineResource({
|
|
43
|
+
name: "notifications",
|
|
44
|
+
label: { en: "Notifications", ru: "Уведомления" },
|
|
45
|
+
model: "notification",
|
|
46
|
+
titleField: "title",
|
|
47
|
+
icon: "Bell",
|
|
48
|
+
i18n: { defaultLocale: "en", locales: ["en", "ru"] },
|
|
49
|
+
listScope: {
|
|
50
|
+
type: "userOwns",
|
|
51
|
+
field: "userId",
|
|
52
|
+
bypassPermissions: ["notifications.read.all", "*"]
|
|
53
|
+
},
|
|
54
|
+
permissions: {
|
|
55
|
+
read: "notifications.read",
|
|
56
|
+
create: "notifications.create",
|
|
57
|
+
update: "notifications.update",
|
|
58
|
+
delete: "notifications.delete",
|
|
59
|
+
markRead: "notifications.update"
|
|
60
|
+
},
|
|
61
|
+
fields: {
|
|
62
|
+
id: { type: "id", label: "ID", create: false, edit: false, list: false },
|
|
63
|
+
title: { type: "text", label: { en: "Title", ru: "Заголовок" }, searchable: true },
|
|
64
|
+
body: { type: "textarea", label: { en: "Body", ru: "Текст" }, list: false },
|
|
65
|
+
readAt: { type: "datetime", label: { en: "Read at", ru: "Прочитано" }, create: false, edit: false },
|
|
66
|
+
createdAt: { type: "datetime", label: { en: "Created", ru: "Создано" }, create: false, edit: false, sortable: true }
|
|
67
|
+
},
|
|
68
|
+
actions: {
|
|
69
|
+
"mark-read": {
|
|
70
|
+
label: { en: "Mark read", ru: "Прочитано" },
|
|
71
|
+
variant: "primary",
|
|
72
|
+
permission: "notifications.update",
|
|
73
|
+
async handler(ctx) {
|
|
74
|
+
const db = ctx.prisma as PrismaClient;
|
|
75
|
+
return db.notification.update({
|
|
76
|
+
where: { id: ctx.id },
|
|
77
|
+
data: { readAt: new Date() }
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"mark-unread": {
|
|
82
|
+
label: { en: "Mark unread", ru: "Не прочитано" },
|
|
83
|
+
variant: "default",
|
|
84
|
+
permission: "notifications.update",
|
|
85
|
+
async handler(ctx) {
|
|
86
|
+
const db = ctx.prisma as PrismaClient;
|
|
87
|
+
return db.notification.update({
|
|
88
|
+
where: { id: ctx.id },
|
|
89
|
+
data: { readAt: null }
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
export const jobLogsResource = defineResource({
|
|
97
|
+
name: "job-logs",
|
|
98
|
+
label: "Job Logs",
|
|
99
|
+
model: "jobLog",
|
|
100
|
+
titleField: "name",
|
|
101
|
+
icon: "Gauge",
|
|
102
|
+
permissions: { read: "jobs.read" },
|
|
103
|
+
fields: {
|
|
104
|
+
id: { type: "id", label: "ID", create: false, edit: false, list: false },
|
|
105
|
+
name: { type: "text", label: "Job", searchable: true },
|
|
106
|
+
status: { type: "badge", label: "Status", filterable: true },
|
|
107
|
+
payload: { type: "json", label: "Payload", list: false },
|
|
108
|
+
error: { type: "textarea", label: "Error", list: false },
|
|
109
|
+
createdAt: { type: "datetime", label: "Created", create: false, edit: false, sortable: true }
|
|
110
|
+
}
|
|
111
|
+
});
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { PrismaClient } from "@prisma/client";
|
|
2
|
+
import { defineResource } from "@openadminjs/core";
|
|
3
|
+
|
|
4
|
+
export default defineResource({
|
|
5
|
+
name: "posts",
|
|
6
|
+
label: { en: "Posts", ru: "Записи" },
|
|
7
|
+
model: "post",
|
|
8
|
+
titleField: "title",
|
|
9
|
+
icon: "FileText",
|
|
10
|
+
i18n: {
|
|
11
|
+
defaultLocale: "en",
|
|
12
|
+
locales: ["en", "ru"]
|
|
13
|
+
},
|
|
14
|
+
seo: {
|
|
15
|
+
public: true,
|
|
16
|
+
slugField: "slug",
|
|
17
|
+
pathPattern: "/posts/:slug",
|
|
18
|
+
titleField: "title",
|
|
19
|
+
descriptionField: "content",
|
|
20
|
+
alternateSlugFields: { ru: "slug" }
|
|
21
|
+
},
|
|
22
|
+
permissions: {
|
|
23
|
+
read: "posts.read",
|
|
24
|
+
create: "posts.create",
|
|
25
|
+
update: "posts.update",
|
|
26
|
+
delete: "posts.delete",
|
|
27
|
+
publish: "posts.publish"
|
|
28
|
+
},
|
|
29
|
+
fields: {
|
|
30
|
+
id: { type: "id", label: { en: "ID", ru: "ID" }, create: false, edit: false, list: false },
|
|
31
|
+
title: {
|
|
32
|
+
type: "text",
|
|
33
|
+
label: { en: "Title", ru: "Заголовок" },
|
|
34
|
+
required: true,
|
|
35
|
+
searchable: true,
|
|
36
|
+
sortable: true
|
|
37
|
+
},
|
|
38
|
+
slug: {
|
|
39
|
+
type: "slug",
|
|
40
|
+
label: { en: "Slug", ru: "Слаг" },
|
|
41
|
+
from: "title",
|
|
42
|
+
searchable: true
|
|
43
|
+
},
|
|
44
|
+
status: {
|
|
45
|
+
type: "select",
|
|
46
|
+
label: { en: "Status", ru: "Статус" },
|
|
47
|
+
options: ["draft", "published", "archived"],
|
|
48
|
+
filterable: true,
|
|
49
|
+
sortable: true
|
|
50
|
+
},
|
|
51
|
+
content: { type: "richtext", label: { en: "Content", ru: "Текст" }, list: false },
|
|
52
|
+
categoryId: {
|
|
53
|
+
type: "relation",
|
|
54
|
+
label: { en: "Category", ru: "Категория" },
|
|
55
|
+
resource: "categories",
|
|
56
|
+
displayField: "name",
|
|
57
|
+
filterable: true
|
|
58
|
+
},
|
|
59
|
+
coverImageId: {
|
|
60
|
+
type: "image",
|
|
61
|
+
label: { en: "Cover image", ru: "Обложка" },
|
|
62
|
+
resource: "files",
|
|
63
|
+
list: false
|
|
64
|
+
},
|
|
65
|
+
createdAt: {
|
|
66
|
+
type: "datetime",
|
|
67
|
+
label: { en: "Created at", ru: "Создано" },
|
|
68
|
+
create: false,
|
|
69
|
+
edit: false,
|
|
70
|
+
sortable: true
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
actions: {
|
|
74
|
+
publish: {
|
|
75
|
+
label: { en: "Publish", ru: "Опубликовать" },
|
|
76
|
+
variant: "primary",
|
|
77
|
+
confirm: true,
|
|
78
|
+
permission: "posts.publish",
|
|
79
|
+
async handler(ctx) {
|
|
80
|
+
const db = ctx.prisma as PrismaClient;
|
|
81
|
+
return db.post.update({
|
|
82
|
+
where: { id: ctx.id },
|
|
83
|
+
data: { status: "published" }
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ResourceConfig } from "@openadminjs/core";
|
|
2
|
+
import posts from "./posts.resource";
|
|
3
|
+
import categories from "./categories.resource";
|
|
4
|
+
import users from "./users.resource";
|
|
5
|
+
import { auditLogsResource, filesResource, settingsResource } from "./system.resource";
|
|
6
|
+
import { apiTokensResource, jobLogsResource, notificationsResource } from "./operations.resource";
|
|
7
|
+
import { ordersResource, productsResource, transactionsResource, webhookLogsResource } from "./commerce.resource";
|
|
8
|
+
|
|
9
|
+
export const resources = [
|
|
10
|
+
posts,
|
|
11
|
+
categories,
|
|
12
|
+
users,
|
|
13
|
+
filesResource,
|
|
14
|
+
auditLogsResource,
|
|
15
|
+
settingsResource,
|
|
16
|
+
apiTokensResource,
|
|
17
|
+
notificationsResource,
|
|
18
|
+
jobLogsResource,
|
|
19
|
+
productsResource,
|
|
20
|
+
ordersResource,
|
|
21
|
+
transactionsResource,
|
|
22
|
+
webhookLogsResource
|
|
23
|
+
] satisfies ResourceConfig[];
|
|
24
|
+
|
|
25
|
+
export function getResource(name: string): ResourceConfig | undefined {
|
|
26
|
+
return resources.find((resource) => resource.name === name);
|
|
27
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { registerResourceHooks } from "./resource-hooks.registry";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Side-effect module: import from `app.module` so hooks are registered at startup.
|
|
5
|
+
* Add `registerResourceHooks` calls here — handlers stay on the server and never ship in JSON metadata.
|
|
6
|
+
*/
|
|
7
|
+
registerResourceHooks(
|
|
8
|
+
"posts",
|
|
9
|
+
{
|
|
10
|
+
beforeCreate({ data }) {
|
|
11
|
+
if (typeof data.title === "string") data.title = data.title.trim();
|
|
12
|
+
},
|
|
13
|
+
beforeUpdate({ data }) {
|
|
14
|
+
if (typeof data.title === "string") data.title = data.title.trim();
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
{ source: "core" }
|
|
18
|
+
);
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { describe, expect, it, beforeEach } from "vitest";
|
|
2
|
+
import { runBeforeCreate } from "./resource-hooks.runner";
|
|
3
|
+
import {
|
|
4
|
+
registerResourceHooks,
|
|
5
|
+
resetResourceHookRegistryForTests,
|
|
6
|
+
unregisterResourceHooksBySource
|
|
7
|
+
} from "./resource-hooks.registry";
|
|
8
|
+
import type { ResourceConfig } from "@openadminjs/core";
|
|
9
|
+
|
|
10
|
+
const stubResource = { name: "x", label: "X", model: "M", permissions: { read: "x.read", create: "x.c" }, fields: {} } as unknown as ResourceConfig;
|
|
11
|
+
|
|
12
|
+
describe("resource hook registry", () => {
|
|
13
|
+
beforeEach(() => resetResourceHookRegistryForTests());
|
|
14
|
+
|
|
15
|
+
it("stacks hooks in registration order", async () => {
|
|
16
|
+
const order: string[] = [];
|
|
17
|
+
registerResourceHooks("posts", {
|
|
18
|
+
beforeCreate() {
|
|
19
|
+
order.push("a");
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
registerResourceHooks("posts", {
|
|
23
|
+
beforeCreate() {
|
|
24
|
+
order.push("b");
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
await runBeforeCreate("posts", stubResource, { id: "1", email: "e", permissions: [] }, {}, {});
|
|
28
|
+
expect(order).toEqual(["a", "b"]);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("replace clears prior hooks for that resource", async () => {
|
|
32
|
+
const order: string[] = [];
|
|
33
|
+
registerResourceHooks("posts", {
|
|
34
|
+
beforeCreate() {
|
|
35
|
+
order.push("first");
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
registerResourceHooks(
|
|
39
|
+
"posts",
|
|
40
|
+
{
|
|
41
|
+
beforeCreate() {
|
|
42
|
+
order.push("only");
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
{ replace: true }
|
|
46
|
+
);
|
|
47
|
+
await runBeforeCreate("posts", stubResource, { id: "1", email: "e", permissions: [] }, {}, {});
|
|
48
|
+
expect(order).toEqual(["only"]);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("unregisterResourceHooksBySource removes only matching source", async () => {
|
|
52
|
+
const order: string[] = [];
|
|
53
|
+
registerResourceHooks(
|
|
54
|
+
"posts",
|
|
55
|
+
{ beforeCreate() { order.push("core"); } },
|
|
56
|
+
{ source: "core" }
|
|
57
|
+
);
|
|
58
|
+
registerResourceHooks(
|
|
59
|
+
"posts",
|
|
60
|
+
{ beforeCreate() { order.push("p1"); } },
|
|
61
|
+
{ source: "plugin-a" }
|
|
62
|
+
);
|
|
63
|
+
registerResourceHooks(
|
|
64
|
+
"posts",
|
|
65
|
+
{ beforeCreate() { order.push("p2"); } },
|
|
66
|
+
{ source: "plugin-b" }
|
|
67
|
+
);
|
|
68
|
+
unregisterResourceHooksBySource("plugin-a");
|
|
69
|
+
await runBeforeCreate("posts", stubResource, { id: "1", email: "e", permissions: [] }, {}, {});
|
|
70
|
+
expect(order).toEqual(["core", "p2"]);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { ResourceLifecycleHooks } from "@openadminjs/plugin-sdk";
|
|
2
|
+
|
|
3
|
+
export type {
|
|
4
|
+
AfterCreateCtx,
|
|
5
|
+
AfterDeleteCtx,
|
|
6
|
+
AfterUpdateCtx,
|
|
7
|
+
BeforeCreateCtx,
|
|
8
|
+
BeforeDeleteCtx,
|
|
9
|
+
BeforeUpdateCtx,
|
|
10
|
+
ResourceHookUser,
|
|
11
|
+
ResourceLifecycleHooks
|
|
12
|
+
} from "@openadminjs/plugin-sdk";
|
|
13
|
+
|
|
14
|
+
type HookEntry = { hooks: ResourceLifecycleHooks; source?: string };
|
|
15
|
+
|
|
16
|
+
const registry = new Map<string, HookEntry[]>();
|
|
17
|
+
|
|
18
|
+
/** Clears all hooks (Vitest only). */
|
|
19
|
+
export function resetResourceHookRegistryForTests(): void {
|
|
20
|
+
registry.clear();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type RegisterResourceHooksOptions = {
|
|
24
|
+
/** Replace the whole chain for this resource (default: append). */
|
|
25
|
+
replace?: boolean;
|
|
26
|
+
/** e.g. plugin id or `core` */
|
|
27
|
+
source?: string;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Register server-only hooks (not serialised to the admin client).
|
|
32
|
+
* Multiple callers stack in registration order unless `replace: true`.
|
|
33
|
+
*/
|
|
34
|
+
export function registerResourceHooks(
|
|
35
|
+
resourceName: string,
|
|
36
|
+
hooks: ResourceLifecycleHooks,
|
|
37
|
+
options?: RegisterResourceHooksOptions
|
|
38
|
+
): void {
|
|
39
|
+
const entry: HookEntry = { hooks, source: options?.source };
|
|
40
|
+
if (options?.replace) {
|
|
41
|
+
registry.set(resourceName, [entry]);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const list = registry.get(resourceName) ?? [];
|
|
45
|
+
list.push(entry);
|
|
46
|
+
registry.set(resourceName, list);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function getResourceHookChain(resourceName: string): readonly HookEntry[] {
|
|
50
|
+
return registry.get(resourceName) ?? [];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Remove all hook entries registered with this source (e.g. plugin manifest id).
|
|
55
|
+
* Core hooks use source `"core"` — never pass that for plugin toggles.
|
|
56
|
+
*/
|
|
57
|
+
export function unregisterResourceHooksBySource(source: string): void {
|
|
58
|
+
const names = [...registry.keys()];
|
|
59
|
+
for (const resourceName of names) {
|
|
60
|
+
const list = registry.get(resourceName);
|
|
61
|
+
if (!list?.length) continue;
|
|
62
|
+
const next = list.filter((e) => e.source !== source);
|
|
63
|
+
if (next.length === 0) registry.delete(resourceName);
|
|
64
|
+
else if (next.length !== list.length) registry.set(resourceName, next);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { ResourceConfig } from "@openadminjs/core";
|
|
2
|
+
import type { ResourceHookUser } from "./resource-hooks.registry";
|
|
3
|
+
import { getResourceHookChain } from "./resource-hooks.registry";
|
|
4
|
+
import { pluginRuntime } from "../plugins/plugin-runtime";
|
|
5
|
+
|
|
6
|
+
function mergedHookChain(resourceName: string) {
|
|
7
|
+
const coreChain = getResourceHookChain(resourceName).map((entry) => entry.hooks);
|
|
8
|
+
const pluginChain = pluginRuntime.getResourceHookChain(resourceName);
|
|
9
|
+
return [...coreChain, ...pluginChain];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export async function runBeforeCreate(
|
|
13
|
+
resourceName: string,
|
|
14
|
+
resource: ResourceConfig,
|
|
15
|
+
user: ResourceHookUser,
|
|
16
|
+
prisma: unknown,
|
|
17
|
+
data: Record<string, unknown>
|
|
18
|
+
): Promise<void> {
|
|
19
|
+
const ctx = { resource, resourceName, user, prisma, data };
|
|
20
|
+
for (const hooks of mergedHookChain(resourceName)) {
|
|
21
|
+
await hooks.beforeCreate?.(ctx);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export async function runAfterCreate(
|
|
26
|
+
resourceName: string,
|
|
27
|
+
resource: ResourceConfig,
|
|
28
|
+
user: ResourceHookUser,
|
|
29
|
+
prisma: unknown,
|
|
30
|
+
data: Record<string, unknown>,
|
|
31
|
+
record: unknown
|
|
32
|
+
): Promise<void> {
|
|
33
|
+
const ctx = { resource, resourceName, user, prisma, data, record };
|
|
34
|
+
for (const hooks of mergedHookChain(resourceName)) {
|
|
35
|
+
await hooks.afterCreate?.(ctx);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export async function runBeforeUpdate(
|
|
40
|
+
resourceName: string,
|
|
41
|
+
resource: ResourceConfig,
|
|
42
|
+
user: ResourceHookUser,
|
|
43
|
+
prisma: unknown,
|
|
44
|
+
id: string,
|
|
45
|
+
data: Record<string, unknown>
|
|
46
|
+
): Promise<void> {
|
|
47
|
+
const ctx = { resource, resourceName, user, prisma, id, data };
|
|
48
|
+
for (const hooks of mergedHookChain(resourceName)) {
|
|
49
|
+
await hooks.beforeUpdate?.(ctx);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export async function runAfterUpdate(
|
|
54
|
+
resourceName: string,
|
|
55
|
+
resource: ResourceConfig,
|
|
56
|
+
user: ResourceHookUser,
|
|
57
|
+
prisma: unknown,
|
|
58
|
+
id: string,
|
|
59
|
+
data: Record<string, unknown>,
|
|
60
|
+
before: unknown,
|
|
61
|
+
record: unknown
|
|
62
|
+
): Promise<void> {
|
|
63
|
+
const ctx = { resource, resourceName, user, prisma, id, data, before, record };
|
|
64
|
+
for (const hooks of mergedHookChain(resourceName)) {
|
|
65
|
+
await hooks.afterUpdate?.(ctx);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export async function runBeforeDelete(
|
|
70
|
+
resourceName: string,
|
|
71
|
+
resource: ResourceConfig,
|
|
72
|
+
user: ResourceHookUser,
|
|
73
|
+
prisma: unknown,
|
|
74
|
+
id: string
|
|
75
|
+
): Promise<void> {
|
|
76
|
+
const ctx = { resource, resourceName, user, prisma, id };
|
|
77
|
+
for (const hooks of mergedHookChain(resourceName)) {
|
|
78
|
+
await hooks.beforeDelete?.(ctx);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export async function runAfterDelete(
|
|
83
|
+
resourceName: string,
|
|
84
|
+
resource: ResourceConfig,
|
|
85
|
+
user: ResourceHookUser,
|
|
86
|
+
prisma: unknown,
|
|
87
|
+
id: string
|
|
88
|
+
): Promise<void> {
|
|
89
|
+
const ctx = { resource, resourceName, user, prisma, id };
|
|
90
|
+
for (const hooks of mergedHookChain(resourceName)) {
|
|
91
|
+
await hooks.afterDelete?.(ctx);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { defineResource } from "@openadminjs/core";
|
|
2
|
+
|
|
3
|
+
export const filesResource = defineResource({
|
|
4
|
+
name: "files",
|
|
5
|
+
label: "Files",
|
|
6
|
+
model: "fileAsset",
|
|
7
|
+
titleField: "filename",
|
|
8
|
+
icon: "Image",
|
|
9
|
+
permissions: { read: "files.read", create: "files.create", delete: "files.delete" },
|
|
10
|
+
fields: {
|
|
11
|
+
id: { type: "id", create: false, edit: false, list: false },
|
|
12
|
+
filename: { type: "text", label: "Filename", searchable: true },
|
|
13
|
+
mimeType: { type: "text", label: "MIME", filterable: true },
|
|
14
|
+
size: { type: "number", label: "Size" },
|
|
15
|
+
createdAt: { type: "datetime", label: "Created", create: false, edit: false }
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export const auditLogsResource = defineResource({
|
|
20
|
+
name: "audit-logs",
|
|
21
|
+
label: "Audit Logs",
|
|
22
|
+
model: "auditLog",
|
|
23
|
+
titleField: "action",
|
|
24
|
+
icon: "History",
|
|
25
|
+
permissions: { read: "audit-logs.read" },
|
|
26
|
+
fields: {
|
|
27
|
+
id: { type: "id", create: false, edit: false, list: false },
|
|
28
|
+
action: { type: "badge", label: "Action", filterable: true },
|
|
29
|
+
resource: { type: "text", label: "Resource", filterable: true },
|
|
30
|
+
resourceId: { type: "text", label: "Resource ID", list: false },
|
|
31
|
+
before: { type: "json", label: "Before", list: false },
|
|
32
|
+
after: { type: "json", label: "After", list: false },
|
|
33
|
+
createdAt: { type: "datetime", label: "Created", create: false, edit: false, sortable: true }
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const settingsResource = defineResource({
|
|
38
|
+
name: "settings",
|
|
39
|
+
label: "Settings",
|
|
40
|
+
model: "setting",
|
|
41
|
+
titleField: "key",
|
|
42
|
+
icon: "Settings",
|
|
43
|
+
permissions: { read: "settings.read", update: "settings.update" },
|
|
44
|
+
fields: {
|
|
45
|
+
id: { type: "id", create: false, edit: false, list: false },
|
|
46
|
+
key: { type: "text", label: "Key", searchable: true },
|
|
47
|
+
group: { type: "text", label: "Group", filterable: true },
|
|
48
|
+
type: { type: "select", label: "Type", options: ["string", "boolean", "number", "json", "color"] },
|
|
49
|
+
value: { type: "json", label: "Value" }
|
|
50
|
+
}
|
|
51
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineResource } from "@openadminjs/core";
|
|
2
|
+
|
|
3
|
+
export default defineResource({
|
|
4
|
+
name: "users",
|
|
5
|
+
label: "Users",
|
|
6
|
+
model: "user",
|
|
7
|
+
titleField: "email",
|
|
8
|
+
icon: "Users",
|
|
9
|
+
permissions: { read: "users.read" },
|
|
10
|
+
fields: {
|
|
11
|
+
id: { type: "id", label: "ID", create: false, edit: false, list: false },
|
|
12
|
+
email: { type: "email", label: "Email", searchable: true, sortable: true },
|
|
13
|
+
passwordHash: { type: "hidden", label: "Password hash" },
|
|
14
|
+
name: { type: "text", label: "Name", searchable: true },
|
|
15
|
+
avatarUrl: { type: "image", label: "Avatar", list: false },
|
|
16
|
+
status: { type: "badge", label: "Status", filterable: true },
|
|
17
|
+
createdAt: { type: "datetime", label: "Created", create: false, edit: false, sortable: true }
|
|
18
|
+
}
|
|
19
|
+
});
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Body,
|
|
3
|
+
Controller,
|
|
4
|
+
Get,
|
|
5
|
+
Headers,
|
|
6
|
+
Param,
|
|
7
|
+
Post,
|
|
8
|
+
Query,
|
|
9
|
+
Req,
|
|
10
|
+
UseGuards
|
|
11
|
+
} from "@nestjs/common";
|
|
12
|
+
import type { RawBodyRequest } from "@nestjs/common";
|
|
13
|
+
import { AuthGuard } from "../../common/auth.guard";
|
|
14
|
+
import { CurrentUser } from "../../common/current-user.decorator";
|
|
15
|
+
import { PaymentService } from "./payment.service";
|
|
16
|
+
import type { CreateOrderInput } from "./payment.service";
|
|
17
|
+
|
|
18
|
+
type UserContext = { id: string; email?: string; permissions: string[] };
|
|
19
|
+
type RequestLike = { user?: UserContext; rawBody?: Buffer };
|
|
20
|
+
|
|
21
|
+
@Controller("store")
|
|
22
|
+
export class PaymentController {
|
|
23
|
+
constructor(private readonly paymentService: PaymentService) {}
|
|
24
|
+
|
|
25
|
+
// ──────────────────────────────────────────────
|
|
26
|
+
// Public endpoints — no JWT required
|
|
27
|
+
// ──────────────────────────────────────────────
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* GET /store/products
|
|
31
|
+
* List all active products (public storefront).
|
|
32
|
+
*/
|
|
33
|
+
@Get("products")
|
|
34
|
+
products() {
|
|
35
|
+
return this.paymentService.listProducts(true);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* POST /store/checkout
|
|
40
|
+
* Create an order + payment session.
|
|
41
|
+
* Works for guests (no auth) and authenticated users.
|
|
42
|
+
*/
|
|
43
|
+
@Post("checkout")
|
|
44
|
+
checkout(
|
|
45
|
+
@Body() body: CreateOrderInput & { guestEmail?: string },
|
|
46
|
+
@Req() req: RequestLike
|
|
47
|
+
) {
|
|
48
|
+
return this.paymentService.createCheckout({
|
|
49
|
+
...body,
|
|
50
|
+
userId: req.user?.id,
|
|
51
|
+
email: body.email ?? body.guestEmail ?? req.user?.email
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* GET /store/orders/:id/status
|
|
57
|
+
* Public order status check (e.g. success page after redirect).
|
|
58
|
+
*/
|
|
59
|
+
@Get("orders/:id/status")
|
|
60
|
+
orderStatus(@Param("id") id: string) {
|
|
61
|
+
return this.paymentService.getOrderStatus(id);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* POST /store/webhook/:provider
|
|
66
|
+
* Receive payment events from the provider.
|
|
67
|
+
* Authentication is signature-based (handled in PaymentService).
|
|
68
|
+
*/
|
|
69
|
+
@Post("webhook/:provider")
|
|
70
|
+
webhook(
|
|
71
|
+
@Param("provider") provider: string,
|
|
72
|
+
@Headers("stripe-signature") stripeSignature: string | undefined,
|
|
73
|
+
@Headers("x-webhook-signature") genericSignature: string | undefined,
|
|
74
|
+
@Req() req: RawBodyRequest<RequestLike>
|
|
75
|
+
) {
|
|
76
|
+
const signature = stripeSignature ?? genericSignature ?? "";
|
|
77
|
+
const rawBody = req.rawBody ?? Buffer.from("{}");
|
|
78
|
+
return this.paymentService.handleWebhook(provider, rawBody, signature);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// ──────────────────────────────────────────────
|
|
82
|
+
// Authenticated user endpoints
|
|
83
|
+
// ──────────────────────────────────────────────
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* GET /store/orders
|
|
87
|
+
* List orders belonging to the current user.
|
|
88
|
+
*/
|
|
89
|
+
@UseGuards(AuthGuard)
|
|
90
|
+
@Get("orders")
|
|
91
|
+
myOrders(
|
|
92
|
+
@CurrentUser() user: UserContext,
|
|
93
|
+
@Query("page") page?: string,
|
|
94
|
+
@Query("limit") limit?: string
|
|
95
|
+
) {
|
|
96
|
+
return this.paymentService.getUserOrders(user.id, Number(page ?? 1), Number(limit ?? 20));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Module } from "@nestjs/common";
|
|
2
|
+
import { PrismaService } from "../../common/prisma.service";
|
|
3
|
+
import { AuthModule } from "../../auth/auth.module";
|
|
4
|
+
import { PaymentProviderService } from "./payment.provider";
|
|
5
|
+
import { PaymentService } from "./payment.service";
|
|
6
|
+
import { PaymentController } from "./payment.controller";
|
|
7
|
+
|
|
8
|
+
@Module({
|
|
9
|
+
imports: [AuthModule],
|
|
10
|
+
controllers: [PaymentController],
|
|
11
|
+
providers: [PrismaService, PaymentProviderService, PaymentService],
|
|
12
|
+
exports: [PaymentService, PaymentProviderService]
|
|
13
|
+
})
|
|
14
|
+
export class PaymentModule {}
|