@hedhog/admin 0.48.10 → 0.48.11

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 (82) hide show
  1. package/dist/admin.module.d.ts.map +1 -1
  2. package/dist/admin.module.js +3 -1
  3. package/dist/admin.module.js.map +1 -1
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +1 -0
  7. package/dist/index.js.map +1 -1
  8. package/dist/setting/dto/create.dto.d.ts +9 -0
  9. package/dist/setting/dto/create.dto.d.ts.map +1 -0
  10. package/dist/setting/dto/create.dto.js +40 -0
  11. package/dist/setting/dto/create.dto.js.map +1 -0
  12. package/dist/setting/dto/delete.dto.d.ts +4 -0
  13. package/dist/setting/dto/delete.dto.d.ts.map +1 -0
  14. package/dist/setting/dto/delete.dto.js +23 -0
  15. package/dist/setting/dto/delete.dto.js.map +1 -0
  16. package/dist/setting/dto/setting-user.dto.d.ts +4 -0
  17. package/dist/setting/dto/setting-user.dto.d.ts.map +1 -0
  18. package/dist/setting/dto/setting-user.dto.js +21 -0
  19. package/dist/setting/dto/setting-user.dto.js.map +1 -0
  20. package/dist/setting/dto/setting.dto.d.ts +9 -0
  21. package/dist/setting/dto/setting.dto.d.ts.map +1 -0
  22. package/dist/setting/dto/setting.dto.js +34 -0
  23. package/dist/setting/dto/setting.dto.js.map +1 -0
  24. package/dist/setting/dto/update.dto.d.ts +6 -0
  25. package/dist/setting/dto/update.dto.d.ts.map +1 -0
  26. package/dist/setting/dto/update.dto.js +9 -0
  27. package/dist/setting/dto/update.dto.js.map +1 -0
  28. package/dist/setting/setting.controller.d.ts +102 -0
  29. package/dist/setting/setting.controller.d.ts.map +1 -0
  30. package/dist/setting/setting.controller.js +160 -0
  31. package/dist/setting/setting.controller.js.map +1 -0
  32. package/dist/setting/setting.module.d.ts +3 -0
  33. package/dist/setting/setting.module.d.ts.map +1 -0
  34. package/dist/setting/setting.module.js +24 -0
  35. package/dist/setting/setting.module.js.map +1 -0
  36. package/dist/setting/setting.service.d.ts +103 -0
  37. package/dist/setting/setting.service.d.ts.map +1 -0
  38. package/dist/setting/setting.service.js +333 -0
  39. package/dist/setting/setting.service.js.map +1 -0
  40. package/frontend/dashboard/components/create-panel.tsx.ejs +63 -63
  41. package/frontend/dashboard/components/dashboard.screen.tsx.ejs +116 -116
  42. package/frontend/dashboard/components/update-panel.tsx.ejs +80 -80
  43. package/frontend/dashboard/locales/en/dashboard.dashboard.json +11 -11
  44. package/frontend/dashboard/locales/pt/dashboard.dashboard.json +11 -11
  45. package/frontend/dashboard/react-query/handlers.ts.ejs +28 -28
  46. package/frontend/dashboard/react-query/requests.ts.ejs +56 -56
  47. package/frontend/dashboard-component/components/create-panel.tsx.ejs +130 -130
  48. package/frontend/dashboard-component/components/update-panel.tsx.ejs +164 -164
  49. package/frontend/dashboard-component/locales/en/dashboard.dashboard-component.json +11 -11
  50. package/frontend/dashboard-component/locales/pt/dashboard.dashboard-component.json +11 -11
  51. package/frontend/dashboard-component/react-query/handlers.ts.ejs +28 -28
  52. package/frontend/dashboard-component/react-query/requests.ts.ejs +61 -61
  53. package/frontend/dashboard-item/components/create-panel.tsx.ejs +108 -108
  54. package/frontend/dashboard-item/components/update-panel.tsx.ejs +141 -141
  55. package/frontend/dashboard-item/locales/en/dashboard.dashboard-item.json +11 -11
  56. package/frontend/dashboard-item/locales/pt/dashboard.dashboard-item.json +11 -11
  57. package/frontend/dashboard-item/react-query/handlers.ts.ejs +28 -28
  58. package/frontend/dashboard-item/react-query/requests.ts.ejs +58 -58
  59. package/frontend/dashboard-user/components/create-panel.tsx.ejs +108 -108
  60. package/frontend/dashboard-user/components/update-panel.tsx.ejs +137 -137
  61. package/frontend/dashboard-user/locales/en/dashboard.dashboard-user.json +11 -11
  62. package/frontend/dashboard-user/locales/pt/dashboard.dashboard-user.json +11 -11
  63. package/frontend/dashboard-user/react-query/handlers.ts.ejs +28 -28
  64. package/frontend/dashboard-user/react-query/requests.ts.ejs +58 -58
  65. package/hedhog.yaml +244 -0
  66. package/package.json +1 -1
  67. package/src/admin.module.ts +3 -1
  68. package/src/dashboard/dashboard-component/dashboard-component.controller.ts +55 -55
  69. package/src/dashboard/dashboard-component/dto/create.dto.ts +36 -36
  70. package/src/dashboard/dashboard-component/dto/update.dto.ts +4 -4
  71. package/src/dashboard/dashboard-item/dto/update.dto.ts +4 -4
  72. package/src/dashboard/dashboard-user/dto/update.dto.ts +4 -4
  73. package/src/dashboard/index.ts +1 -1
  74. package/src/index.ts +2 -0
  75. package/src/setting/dto/create.dto.ts +21 -0
  76. package/src/setting/dto/delete.dto.ts +8 -0
  77. package/src/setting/dto/setting-user.dto.ts +6 -0
  78. package/src/setting/dto/setting.dto.ts +17 -0
  79. package/src/setting/dto/update.dto.ts +4 -0
  80. package/src/setting/setting.controller.ts +105 -0
  81. package/src/setting/setting.module.ts +11 -0
  82. package/src/setting/setting.service.ts +400 -0
@@ -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-component";
6
-
7
- export function useDashboardComponentCreate() {
8
- const { dashboardComponentCreate } = requests();
9
- return useDefaultMutation(scope, "create", dashboardComponentCreate);
10
- }
11
-
12
- export function useDashboardComponentDelete() {
13
- const { dashboardComponentDelete } = requests();
14
- return useDefaultMutation(scope, "delete", dashboardComponentDelete);
15
- }
16
-
17
- export function useDashboardComponentUpdate() {
18
- const { dashboardComponentUpdate } = requests();
19
- return useDefaultMutation(scope, "update", dashboardComponentUpdate);
20
- }
21
-
22
- export function useDashboardComponentGet(id: number) {
23
- const { dashboardComponentGet } = requests();
24
- return useQuery({
25
- queryKey: [scope, "get"],
26
- queryFn: () => dashboardComponentGet(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-component";
6
+
7
+ export function useDashboardComponentCreate() {
8
+ const { dashboardComponentCreate } = requests();
9
+ return useDefaultMutation(scope, "create", dashboardComponentCreate);
10
+ }
11
+
12
+ export function useDashboardComponentDelete() {
13
+ const { dashboardComponentDelete } = requests();
14
+ return useDefaultMutation(scope, "delete", dashboardComponentDelete);
15
+ }
16
+
17
+ export function useDashboardComponentUpdate() {
18
+ const { dashboardComponentUpdate } = requests();
19
+ return useDefaultMutation(scope, "update", dashboardComponentUpdate);
20
+ }
21
+
22
+ export function useDashboardComponentGet(id: number) {
23
+ const { dashboardComponentGet } = requests();
24
+ return useQuery({
25
+ queryKey: [scope, "get"],
26
+ queryFn: () => dashboardComponentGet(id),
27
+ });
28
+ }
@@ -1,61 +1,61 @@
1
- import { useApp } from "@/hooks/use-app";
2
- import { Delete, PaginationParams, PaginationResult } from "@/types";
3
- import { DashboardComponent } 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 dashboardComponentList = async (params: PaginationParams) => {
11
- return request<PaginationResult<DashboardComponent>>({
12
- url: "/dashboard-component",
13
- params,
14
- }).then((res) => res.data);
15
- };
16
-
17
- const dashboardComponentGet = async (id: number) => {
18
- return request<DashboardComponent>({
19
- url: `/dashboard-component/${id}`,
20
- }).then((res) => res.data);
21
- };
22
-
23
- const dashboardComponentCreate = async (params: {
24
- data: DashboardComponent;
25
- }) => {
26
- const { data } = params;
27
- return request<DashboardComponent>({
28
- url: "/dashboard-component",
29
- method: HttpMethod.POST,
30
- data: formatDataWithLocale(data),
31
- }).then((res) => res.data);
32
- };
33
-
34
- const dashboardComponentDelete = async (ids: number[]) => {
35
- return request<Delete>({
36
- url: "/dashboard-component",
37
- data: { ids },
38
- method: HttpMethod.DELETE,
39
- }).then((res) => res.data);
40
- };
41
-
42
- const dashboardComponentUpdate = async (params: {
43
- id: number;
44
- data: DashboardComponent;
45
- }) => {
46
- const { id, data } = params;
47
- return request<DashboardComponent>({
48
- url: `/dashboard-component/${id}`,
49
- method: HttpMethod.PATCH,
50
- data: formatDataWithLocale(data),
51
- }).then((res) => res.data);
52
- };
53
-
54
- return {
55
- dashboardComponentCreate,
56
- dashboardComponentUpdate,
57
- dashboardComponentDelete,
58
- dashboardComponentList,
59
- dashboardComponentGet,
60
- };
61
- }
1
+ import { useApp } from "@/hooks/use-app";
2
+ import { Delete, PaginationParams, PaginationResult } from "@/types";
3
+ import { DashboardComponent } 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 dashboardComponentList = async (params: PaginationParams) => {
11
+ return request<PaginationResult<DashboardComponent>>({
12
+ url: "/dashboard-component",
13
+ params,
14
+ }).then((res) => res.data);
15
+ };
16
+
17
+ const dashboardComponentGet = async (id: number) => {
18
+ return request<DashboardComponent>({
19
+ url: `/dashboard-component/${id}`,
20
+ }).then((res) => res.data);
21
+ };
22
+
23
+ const dashboardComponentCreate = async (params: {
24
+ data: DashboardComponent;
25
+ }) => {
26
+ const { data } = params;
27
+ return request<DashboardComponent>({
28
+ url: "/dashboard-component",
29
+ method: HttpMethod.POST,
30
+ data: formatDataWithLocale(data),
31
+ }).then((res) => res.data);
32
+ };
33
+
34
+ const dashboardComponentDelete = async (ids: number[]) => {
35
+ return request<Delete>({
36
+ url: "/dashboard-component",
37
+ data: { ids },
38
+ method: HttpMethod.DELETE,
39
+ }).then((res) => res.data);
40
+ };
41
+
42
+ const dashboardComponentUpdate = async (params: {
43
+ id: number;
44
+ data: DashboardComponent;
45
+ }) => {
46
+ const { id, data } = params;
47
+ return request<DashboardComponent>({
48
+ url: `/dashboard-component/${id}`,
49
+ method: HttpMethod.PATCH,
50
+ data: formatDataWithLocale(data),
51
+ }).then((res) => res.data);
52
+ };
53
+
54
+ return {
55
+ dashboardComponentCreate,
56
+ dashboardComponentUpdate,
57
+ dashboardComponentDelete,
58
+ dashboardComponentList,
59
+ dashboardComponentGet,
60
+ };
61
+ }
@@ -1,108 +1,108 @@
1
- import FormPanel, { FormPanelRef } from '@/components/panels/form-panel'
2
- import { EnumFieldType } from '@/enums/EnumFieldType'
3
- import { useDashboardItemCreate } from '@/features/admin/dashboard-item'
4
- import { DashboardItem } from '@/types/models'
5
- import { forwardRef, useImperativeHandle, useRef } from 'react'
6
- import { useTranslation } from 'react-i18next'
7
-
8
- export type DashboardItemCreatePanelRef = {
9
- submit: () => void
10
- }
11
-
12
- export type DashboardItemCreatePanelProps = {
13
- onCreated?: (data: DashboardItem) => void
14
- }
15
-
16
- const DashboardItemCreatePanel = forwardRef(
17
- ({ onCreated }: DashboardItemCreatePanelProps, ref) => {
18
- const formRef = useRef<FormPanelRef>(null)
19
- const { t } = useTranslation(['actions', 'fields', 'translations'])
20
- const { mutateAsync: createDashboardItem } = useDashboardItemCreate()
21
-
22
- useImperativeHandle(
23
- ref,
24
- () => ({
25
- submit: () => {
26
- formRef.current?.submit()
27
- },
28
- }),
29
- [formRef]
30
- )
31
-
32
- return (
33
- <FormPanel
34
- ref={formRef}
35
- fields={[
36
- {
37
- name: 'component_id',
38
- label: { text: t('dashboard-item.component_id', { ns: 'fields' }) },
39
- type: EnumFieldType.COMBOBOX,
40
- required: true,
41
- url: '/dashboard-component',
42
- displayName: 'component',
43
- valueName: 'id',
44
- },
45
-
46
- {
47
- name: 'dashboard_id',
48
- label: { text: t('dashboard-item.dashboard_id', { ns: 'fields' }) },
49
- type: EnumFieldType.COMBOBOX,
50
- required: true,
51
- url: '/dashboard',
52
- displayName: 'dashboard',
53
- valueName: 'id',
54
- },
55
-
56
- {
57
- name: 'width',
58
- label: { text: t('dashboard-user.width', { ns: 'fields' }) },
59
- type: EnumFieldType.NUMBER,
60
- required: true,
61
- },
62
-
63
- {
64
- name: 'height',
65
- label: { text: t('dashboard-user.height', { ns: 'fields' }) },
66
- type: EnumFieldType.NUMBER,
67
- required: true,
68
- },
69
-
70
- {
71
- name: 'x_axis',
72
- label: { text: t('dashboard-user.x_axis', { ns: 'fields' }) },
73
- type: EnumFieldType.NUMBER,
74
- required: true,
75
- },
76
-
77
- {
78
- name: 'y_axis',
79
- label: { text: t('dashboard-user.y_axis', { ns: 'fields' }) },
80
- type: EnumFieldType.NUMBER,
81
- required: true,
82
- },
83
- ]}
84
- button={{ text: t('create', { ns: 'actions' }) }}
85
- onSubmit={async (data) => {
86
- const createdData = await createDashboardItem({
87
- data: {
88
- ...data,
89
- component_id: Number(data.component_id),
90
- dashboard_id: Number(data.dashboard_id),
91
- width: Number(data.width),
92
- height: Number(data.height),
93
- x_axis: Number(data.x_axis),
94
- y_axis: Number(data.y_axis),
95
- },
96
- })
97
- if (typeof onCreated === 'function') {
98
- onCreated(createdData as any)
99
- }
100
- }}
101
- />
102
- )
103
- }
104
- )
105
-
106
- DashboardItemCreatePanel.displayName = 'DashboardItemCreatePanel'
107
-
108
- export default DashboardItemCreatePanel
1
+ import FormPanel, { FormPanelRef } from '@/components/panels/form-panel'
2
+ import { EnumFieldType } from '@/enums/EnumFieldType'
3
+ import { useDashboardItemCreate } from '@/features/admin/dashboard-item'
4
+ import { DashboardItem } from '@/types/models'
5
+ import { forwardRef, useImperativeHandle, useRef } from 'react'
6
+ import { useTranslation } from 'react-i18next'
7
+
8
+ export type DashboardItemCreatePanelRef = {
9
+ submit: () => void
10
+ }
11
+
12
+ export type DashboardItemCreatePanelProps = {
13
+ onCreated?: (data: DashboardItem) => void
14
+ }
15
+
16
+ const DashboardItemCreatePanel = forwardRef(
17
+ ({ onCreated }: DashboardItemCreatePanelProps, ref) => {
18
+ const formRef = useRef<FormPanelRef>(null)
19
+ const { t } = useTranslation(['actions', 'fields', 'translations'])
20
+ const { mutateAsync: createDashboardItem } = useDashboardItemCreate()
21
+
22
+ useImperativeHandle(
23
+ ref,
24
+ () => ({
25
+ submit: () => {
26
+ formRef.current?.submit()
27
+ },
28
+ }),
29
+ [formRef]
30
+ )
31
+
32
+ return (
33
+ <FormPanel
34
+ ref={formRef}
35
+ fields={[
36
+ {
37
+ name: 'component_id',
38
+ label: { text: t('dashboard-item.component_id', { ns: 'fields' }) },
39
+ type: EnumFieldType.COMBOBOX,
40
+ required: true,
41
+ url: '/dashboard-component',
42
+ displayName: 'component',
43
+ valueName: 'id',
44
+ },
45
+
46
+ {
47
+ name: 'dashboard_id',
48
+ label: { text: t('dashboard-item.dashboard_id', { ns: 'fields' }) },
49
+ type: EnumFieldType.COMBOBOX,
50
+ required: true,
51
+ url: '/dashboard',
52
+ displayName: 'dashboard',
53
+ valueName: 'id',
54
+ },
55
+
56
+ {
57
+ name: 'width',
58
+ label: { text: t('dashboard-user.width', { ns: 'fields' }) },
59
+ type: EnumFieldType.NUMBER,
60
+ required: true,
61
+ },
62
+
63
+ {
64
+ name: 'height',
65
+ label: { text: t('dashboard-user.height', { ns: 'fields' }) },
66
+ type: EnumFieldType.NUMBER,
67
+ required: true,
68
+ },
69
+
70
+ {
71
+ name: 'x_axis',
72
+ label: { text: t('dashboard-user.x_axis', { ns: 'fields' }) },
73
+ type: EnumFieldType.NUMBER,
74
+ required: true,
75
+ },
76
+
77
+ {
78
+ name: 'y_axis',
79
+ label: { text: t('dashboard-user.y_axis', { ns: 'fields' }) },
80
+ type: EnumFieldType.NUMBER,
81
+ required: true,
82
+ },
83
+ ]}
84
+ button={{ text: t('create', { ns: 'actions' }) }}
85
+ onSubmit={async (data) => {
86
+ const createdData = await createDashboardItem({
87
+ data: {
88
+ ...data,
89
+ component_id: Number(data.component_id),
90
+ dashboard_id: Number(data.dashboard_id),
91
+ width: Number(data.width),
92
+ height: Number(data.height),
93
+ x_axis: Number(data.x_axis),
94
+ y_axis: Number(data.y_axis),
95
+ },
96
+ })
97
+ if (typeof onCreated === 'function') {
98
+ onCreated(createdData as any)
99
+ }
100
+ }}
101
+ />
102
+ )
103
+ }
104
+ )
105
+
106
+ DashboardItemCreatePanel.displayName = 'DashboardItemCreatePanel'
107
+
108
+ export default DashboardItemCreatePanel