@hedhog/admin 0.51.16 → 0.51.21

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.
Files changed (61) hide show
  1. package/dist/admin.module.d.ts.map +1 -1
  2. package/dist/admin.module.js +5 -0
  3. package/dist/admin.module.js.map +1 -1
  4. package/dist/auth/auth.controller.d.ts +12 -6
  5. package/dist/auth/auth.controller.d.ts.map +1 -1
  6. package/dist/auth/auth.controller.js +57 -24
  7. package/dist/auth/auth.controller.js.map +1 -1
  8. package/dist/auth/auth.module.d.ts.map +1 -1
  9. package/dist/auth/auth.module.js +4 -0
  10. package/dist/auth/auth.module.js.map +1 -1
  11. package/dist/auth/auth.service.d.ts +19 -10
  12. package/dist/auth/auth.service.d.ts.map +1 -1
  13. package/dist/auth/auth.service.js +104 -45
  14. package/dist/auth/auth.service.js.map +1 -1
  15. package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts +11 -11
  16. package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts +11 -11
  17. package/dist/dashboard/dashboard-user/dashboard-user.controller.d.ts +3 -3
  18. package/dist/dashboard/dashboard-user/dashboard-user.service.d.ts +3 -3
  19. package/dist/menu/menu.controller.d.ts +3 -3
  20. package/dist/menu/menu.service.d.ts +3 -3
  21. package/dist/setting/setting.service.d.ts.map +1 -1
  22. package/dist/setting/setting.service.js +17 -11
  23. package/dist/setting/setting.service.js.map +1 -1
  24. package/frontend/dashboard/components/create-panel.tsx.ejs +63 -63
  25. package/frontend/dashboard/components/dashboard.screen.tsx.ejs +116 -116
  26. package/frontend/dashboard/components/update-panel.tsx.ejs +80 -80
  27. package/frontend/dashboard/locales/en/dashboard.dashboard.json +11 -11
  28. package/frontend/dashboard/locales/pt/dashboard.dashboard.json +11 -11
  29. package/frontend/dashboard/react-query/handlers.ts.ejs +28 -28
  30. package/frontend/dashboard/react-query/requests.ts.ejs +56 -56
  31. package/frontend/dashboard-component/components/create-panel.tsx.ejs +130 -130
  32. package/frontend/dashboard-component/components/update-panel.tsx.ejs +164 -164
  33. package/frontend/dashboard-component/locales/en/dashboard.dashboard-component.json +11 -11
  34. package/frontend/dashboard-component/locales/pt/dashboard.dashboard-component.json +11 -11
  35. package/frontend/dashboard-component/react-query/handlers.ts.ejs +28 -28
  36. package/frontend/dashboard-component/react-query/requests.ts.ejs +61 -61
  37. package/frontend/dashboard-item/components/create-panel.tsx.ejs +108 -108
  38. package/frontend/dashboard-item/components/update-panel.tsx.ejs +141 -141
  39. package/frontend/dashboard-item/locales/en/dashboard.dashboard-item.json +11 -11
  40. package/frontend/dashboard-item/locales/pt/dashboard.dashboard-item.json +11 -11
  41. package/frontend/dashboard-item/react-query/handlers.ts.ejs +28 -28
  42. package/frontend/dashboard-item/react-query/requests.ts.ejs +58 -58
  43. package/frontend/dashboard-user/components/create-panel.tsx.ejs +108 -108
  44. package/frontend/dashboard-user/components/update-panel.tsx.ejs +137 -137
  45. package/frontend/dashboard-user/locales/en/dashboard.dashboard-user.json +11 -11
  46. package/frontend/dashboard-user/locales/pt/dashboard.dashboard-user.json +11 -11
  47. package/frontend/dashboard-user/react-query/handlers.ts.ejs +28 -28
  48. package/frontend/dashboard-user/react-query/requests.ts.ejs +58 -58
  49. package/hedhog.yaml +2 -2
  50. package/package.json +7 -6
  51. package/src/admin.module.ts +5 -0
  52. package/src/auth/auth.controller.ts +37 -11
  53. package/src/auth/auth.module.ts +4 -0
  54. package/src/auth/auth.service.ts +154 -63
  55. package/src/dashboard/dashboard-component/dashboard-component.controller.ts +55 -55
  56. package/src/dashboard/dashboard-component/dto/create.dto.ts +36 -36
  57. package/src/dashboard/dashboard-component/dto/update.dto.ts +4 -4
  58. package/src/dashboard/dashboard-item/dto/update.dto.ts +4 -4
  59. package/src/dashboard/dashboard-user/dto/update.dto.ts +4 -4
  60. package/src/dashboard/index.ts +1 -1
  61. package/src/setting/setting.service.ts +16 -11
@@ -1,28 +1,28 @@
1
- import { useDefaultMutation } from "@/hooks/use-default-mutation";
2
- import { useQuery } from "@tanstack/react-query";
3
- import { requests } from "./requests";
4
-
5
- const scope = "dashboard";
6
-
7
- export function useDashboardCreate() {
8
- const { dashboardCreate } = requests();
9
- return useDefaultMutation(scope, "create", dashboardCreate);
10
- }
11
-
12
- export function useDashboardDelete() {
13
- const { dashboardDelete } = requests();
14
- return useDefaultMutation(scope, "delete", dashboardDelete);
15
- }
16
-
17
- export function useDashboardUpdate() {
18
- const { dashboardUpdate } = requests();
19
- return useDefaultMutation(scope, "update", dashboardUpdate);
20
- }
21
-
22
- export function useDashboardGet(id: number) {
23
- const { dashboardGet } = requests();
24
- return useQuery({
25
- queryKey: [scope, "get"],
26
- queryFn: () => dashboardGet(id),
27
- });
28
- }
1
+ import { useDefaultMutation } from "@/hooks/use-default-mutation";
2
+ import { useQuery } from "@tanstack/react-query";
3
+ import { requests } from "./requests";
4
+
5
+ const scope = "dashboard";
6
+
7
+ export function useDashboardCreate() {
8
+ const { dashboardCreate } = requests();
9
+ return useDefaultMutation(scope, "create", dashboardCreate);
10
+ }
11
+
12
+ export function useDashboardDelete() {
13
+ const { dashboardDelete } = requests();
14
+ return useDefaultMutation(scope, "delete", dashboardDelete);
15
+ }
16
+
17
+ export function useDashboardUpdate() {
18
+ const { dashboardUpdate } = requests();
19
+ return useDefaultMutation(scope, "update", dashboardUpdate);
20
+ }
21
+
22
+ export function useDashboardGet(id: number) {
23
+ const { dashboardGet } = requests();
24
+ return useQuery({
25
+ queryKey: [scope, "get"],
26
+ queryFn: () => dashboardGet(id),
27
+ });
28
+ }
@@ -1,56 +1,56 @@
1
- import { useApp } from "@/hooks/use-app";
2
- import { Delete, PaginationParams, PaginationResult } from "@/types";
3
- import { Dashboard } from "@/types/models";
4
- import { HttpMethod } from "@/types/http-method";
5
- import { formatDataWithLocale } from '@hedhog/utils'
6
-
7
- export function requests() {
8
- const { request } = useApp();
9
-
10
- const dashboardList = async (params: PaginationParams) => {
11
- return request<PaginationResult<Dashboard>>({
12
- url: "/dashboard",
13
- params,
14
- }).then((res) => res.data);
15
- };
16
-
17
- const dashboardGet = async (id: number) => {
18
- return request<Dashboard>({
19
- url: `/dashboard/${id}`,
20
- }).then((res) => res.data);
21
- };
22
-
23
- const dashboardCreate = async (params: { data: Dashboard }) => {
24
- const { data } = params;
25
- return request<Dashboard>({
26
- url: "/dashboard",
27
- method: HttpMethod.POST,
28
- data: formatDataWithLocale(data),
29
- }).then((res) => res.data);
30
- };
31
-
32
- const dashboardDelete = async (ids: number[]) => {
33
- return request<Delete>({
34
- url: "/dashboard",
35
- data: { ids },
36
- method: HttpMethod.DELETE,
37
- }).then((res) => res.data);
38
- };
39
-
40
- const dashboardUpdate = async (params: { id: number; data: Dashboard }) => {
41
- const { id, data } = params;
42
- return request<Dashboard>({
43
- url: `/dashboard/${id}`,
44
- method: HttpMethod.PATCH,
45
- data: formatDataWithLocale(data),
46
- }).then((res) => res.data);
47
- };
48
-
49
- return {
50
- dashboardCreate,
51
- dashboardUpdate,
52
- dashboardDelete,
53
- dashboardList,
54
- dashboardGet,
55
- };
56
- }
1
+ import { useApp } from "@/hooks/use-app";
2
+ import { Delete, PaginationParams, PaginationResult } from "@/types";
3
+ import { Dashboard } from "@/types/models";
4
+ import { HttpMethod } from "@/types/http-method";
5
+ import { formatDataWithLocale } from '@hedhog/utils'
6
+
7
+ export function requests() {
8
+ const { request } = useApp();
9
+
10
+ const dashboardList = async (params: PaginationParams) => {
11
+ return request<PaginationResult<Dashboard>>({
12
+ url: "/dashboard",
13
+ params,
14
+ }).then((res) => res.data);
15
+ };
16
+
17
+ const dashboardGet = async (id: number) => {
18
+ return request<Dashboard>({
19
+ url: `/dashboard/${id}`,
20
+ }).then((res) => res.data);
21
+ };
22
+
23
+ const dashboardCreate = async (params: { data: Dashboard }) => {
24
+ const { data } = params;
25
+ return request<Dashboard>({
26
+ url: "/dashboard",
27
+ method: HttpMethod.POST,
28
+ data: formatDataWithLocale(data),
29
+ }).then((res) => res.data);
30
+ };
31
+
32
+ const dashboardDelete = async (ids: number[]) => {
33
+ return request<Delete>({
34
+ url: "/dashboard",
35
+ data: { ids },
36
+ method: HttpMethod.DELETE,
37
+ }).then((res) => res.data);
38
+ };
39
+
40
+ const dashboardUpdate = async (params: { id: number; data: Dashboard }) => {
41
+ const { id, data } = params;
42
+ return request<Dashboard>({
43
+ url: `/dashboard/${id}`,
44
+ method: HttpMethod.PATCH,
45
+ data: formatDataWithLocale(data),
46
+ }).then((res) => res.data);
47
+ };
48
+
49
+ return {
50
+ dashboardCreate,
51
+ dashboardUpdate,
52
+ dashboardDelete,
53
+ dashboardList,
54
+ dashboardGet,
55
+ };
56
+ }
@@ -1,130 +1,130 @@
1
- import FormPanel, {
2
- FormPanelRef,
3
- getFieldsLocale,
4
- } from '@/components/panels/form-panel'
5
- import { EnumFieldType } from '@/enums/EnumFieldType'
6
- import { useDashboardComponentCreate } from '@/features/admin/dashboard-component'
7
- import { DashboardComponent } from '@/types/models'
8
- import { forwardRef, useImperativeHandle, useRef } from 'react'
9
- import { useTranslation } from 'react-i18next'
10
-
11
- export type DashboardComponentCreatePanelRef = {
12
- submit: () => void
13
- }
14
-
15
- export type DashboardComponentCreatePanelProps = {
16
- onCreated?: (data: DashboardComponent) => void
17
- }
18
-
19
- const DashboardComponentCreatePanel = forwardRef(
20
- ({ onCreated }: DashboardComponentCreatePanelProps, ref) => {
21
- const formRef = useRef<FormPanelRef>(null)
22
- const { t } = useTranslation(['actions', 'fields', 'translations'])
23
- const { mutateAsync: createDashboardComponent } =
24
- useDashboardComponentCreate()
25
-
26
- useImperativeHandle(
27
- ref,
28
- () => ({
29
- submit: () => {
30
- formRef.current?.submit()
31
- },
32
- }),
33
- [formRef]
34
- )
35
-
36
- return (
37
- <FormPanel
38
- ref={formRef}
39
- fields={[
40
- ...getFieldsLocale([{ name: 'name' }]),
41
- {
42
- name: 'slug',
43
- label: { text: t('dashboard-component.slug', { ns: 'fields' }) },
44
- type: EnumFieldType.TEXT,
45
- required: true,
46
- },
47
- {
48
- name: 'path',
49
- label: { text: t('dashboard-component.path', { ns: 'fields' }) },
50
- type: EnumFieldType.TEXT,
51
- required: true,
52
- },
53
- {
54
- name: 'min_width',
55
- label: {
56
- text: t('dashboard-component.min_width', { ns: 'fields' }),
57
- },
58
- type: EnumFieldType.NUMBER,
59
- required: true,
60
- },
61
- {
62
- name: 'width',
63
- label: { text: t('dashboard-component.width', { ns: 'fields' }) },
64
- type: EnumFieldType.NUMBER,
65
- required: true,
66
- },
67
- {
68
- name: 'max_width',
69
- label: {
70
- text: t('dashboard-component.max_width', { ns: 'fields' }),
71
- },
72
- type: EnumFieldType.NUMBER,
73
- required: true,
74
- },
75
- {
76
- name: 'min_height',
77
- label: {
78
- text: t('dashboard-component.min_height', { ns: 'fields' }),
79
- },
80
- type: EnumFieldType.NUMBER,
81
- required: true,
82
- },
83
- {
84
- name: 'height',
85
- label: { text: t('dashboard-component.height', { ns: 'fields' }) },
86
- type: EnumFieldType.NUMBER,
87
- required: true,
88
- },
89
- {
90
- name: 'max_height',
91
- label: {
92
- text: t('dashboard-component.max_height', { ns: 'fields' }),
93
- },
94
- type: EnumFieldType.NUMBER,
95
- required: true,
96
- },
97
- {
98
- name: 'is_resizable',
99
- label: {
100
- text: t('dashboard-component.is_resizable', { ns: 'fields' }),
101
- },
102
- type: EnumFieldType.SWITCH,
103
- required: true,
104
- },
105
- ]}
106
- button={{ text: t('create', { ns: 'actions' }) }}
107
- onSubmit={async (data) => {
108
- const createdData = await createDashboardComponent({
109
- data: {
110
- ...data,
111
- min_width: Number(data.min_width),
112
- width: Number(data.width),
113
- max_width: Number(data.max_width),
114
- min_height: Number(data.min_height),
115
- height: Number(data.height),
116
- max_height: Number(data.max_height),
117
- },
118
- })
119
- if (typeof onCreated === 'function') {
120
- onCreated(createdData as any)
121
- }
122
- }}
123
- />
124
- )
125
- }
126
- )
127
-
128
- DashboardComponentCreatePanel.displayName = 'DashboardComponentCreatePanel'
129
-
130
- export default DashboardComponentCreatePanel
1
+ import FormPanel, {
2
+ FormPanelRef,
3
+ getFieldsLocale,
4
+ } from '@/components/panels/form-panel'
5
+ import { EnumFieldType } from '@/enums/EnumFieldType'
6
+ import { useDashboardComponentCreate } from '@/features/admin/dashboard-component'
7
+ import { DashboardComponent } from '@/types/models'
8
+ import { forwardRef, useImperativeHandle, useRef } from 'react'
9
+ import { useTranslation } from 'react-i18next'
10
+
11
+ export type DashboardComponentCreatePanelRef = {
12
+ submit: () => void
13
+ }
14
+
15
+ export type DashboardComponentCreatePanelProps = {
16
+ onCreated?: (data: DashboardComponent) => void
17
+ }
18
+
19
+ const DashboardComponentCreatePanel = forwardRef(
20
+ ({ onCreated }: DashboardComponentCreatePanelProps, ref) => {
21
+ const formRef = useRef<FormPanelRef>(null)
22
+ const { t } = useTranslation(['actions', 'fields', 'translations'])
23
+ const { mutateAsync: createDashboardComponent } =
24
+ useDashboardComponentCreate()
25
+
26
+ useImperativeHandle(
27
+ ref,
28
+ () => ({
29
+ submit: () => {
30
+ formRef.current?.submit()
31
+ },
32
+ }),
33
+ [formRef]
34
+ )
35
+
36
+ return (
37
+ <FormPanel
38
+ ref={formRef}
39
+ fields={[
40
+ ...getFieldsLocale([{ name: 'name' }]),
41
+ {
42
+ name: 'slug',
43
+ label: { text: t('dashboard-component.slug', { ns: 'fields' }) },
44
+ type: EnumFieldType.TEXT,
45
+ required: true,
46
+ },
47
+ {
48
+ name: 'path',
49
+ label: { text: t('dashboard-component.path', { ns: 'fields' }) },
50
+ type: EnumFieldType.TEXT,
51
+ required: true,
52
+ },
53
+ {
54
+ name: 'min_width',
55
+ label: {
56
+ text: t('dashboard-component.min_width', { ns: 'fields' }),
57
+ },
58
+ type: EnumFieldType.NUMBER,
59
+ required: true,
60
+ },
61
+ {
62
+ name: 'width',
63
+ label: { text: t('dashboard-component.width', { ns: 'fields' }) },
64
+ type: EnumFieldType.NUMBER,
65
+ required: true,
66
+ },
67
+ {
68
+ name: 'max_width',
69
+ label: {
70
+ text: t('dashboard-component.max_width', { ns: 'fields' }),
71
+ },
72
+ type: EnumFieldType.NUMBER,
73
+ required: true,
74
+ },
75
+ {
76
+ name: 'min_height',
77
+ label: {
78
+ text: t('dashboard-component.min_height', { ns: 'fields' }),
79
+ },
80
+ type: EnumFieldType.NUMBER,
81
+ required: true,
82
+ },
83
+ {
84
+ name: 'height',
85
+ label: { text: t('dashboard-component.height', { ns: 'fields' }) },
86
+ type: EnumFieldType.NUMBER,
87
+ required: true,
88
+ },
89
+ {
90
+ name: 'max_height',
91
+ label: {
92
+ text: t('dashboard-component.max_height', { ns: 'fields' }),
93
+ },
94
+ type: EnumFieldType.NUMBER,
95
+ required: true,
96
+ },
97
+ {
98
+ name: 'is_resizable',
99
+ label: {
100
+ text: t('dashboard-component.is_resizable', { ns: 'fields' }),
101
+ },
102
+ type: EnumFieldType.SWITCH,
103
+ required: true,
104
+ },
105
+ ]}
106
+ button={{ text: t('create', { ns: 'actions' }) }}
107
+ onSubmit={async (data) => {
108
+ const createdData = await createDashboardComponent({
109
+ data: {
110
+ ...data,
111
+ min_width: Number(data.min_width),
112
+ width: Number(data.width),
113
+ max_width: Number(data.max_width),
114
+ min_height: Number(data.min_height),
115
+ height: Number(data.height),
116
+ max_height: Number(data.max_height),
117
+ },
118
+ })
119
+ if (typeof onCreated === 'function') {
120
+ onCreated(createdData as any)
121
+ }
122
+ }}
123
+ />
124
+ )
125
+ }
126
+ )
127
+
128
+ DashboardComponentCreatePanel.displayName = 'DashboardComponentCreatePanel'
129
+
130
+ export default DashboardComponentCreatePanel