@hedhog/admin 0.51.2 → 0.51.4

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 (70) hide show
  1. package/dist/auth/auth.controller.d.ts +4 -0
  2. package/dist/auth/auth.controller.d.ts.map +1 -1
  3. package/dist/auth/auth.controller.js +18 -0
  4. package/dist/auth/auth.controller.js.map +1 -1
  5. package/dist/auth/auth.service.d.ts +4 -0
  6. package/dist/auth/auth.service.d.ts.map +1 -1
  7. package/dist/auth/auth.service.js +22 -0
  8. package/dist/auth/auth.service.js.map +1 -1
  9. package/dist/auth/dto/register.dto.d.ts +8 -0
  10. package/dist/auth/dto/register.dto.d.ts.map +1 -0
  11. package/dist/auth/dto/register.dto.js +47 -0
  12. package/dist/auth/dto/register.dto.js.map +1 -0
  13. package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts +11 -11
  14. package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts +11 -11
  15. package/dist/dashboard/dashboard-user/dashboard-user.controller.d.ts +3 -3
  16. package/dist/dashboard/dashboard-user/dashboard-user.service.d.ts +3 -3
  17. package/dist/menu/menu.controller.d.ts +3 -3
  18. package/dist/menu/menu.service.d.ts +3 -3
  19. package/dist/screen/screen.service.js +1 -1
  20. package/dist/screen/screen.service.js.map +1 -1
  21. package/dist/setting/setting.service.js +1 -1
  22. package/dist/setting/setting.service.js.map +1 -1
  23. package/dist/user/user.controller.d.ts +10 -0
  24. package/dist/user/user.controller.d.ts.map +1 -1
  25. package/dist/user/user.controller.js +10 -0
  26. package/dist/user/user.controller.js.map +1 -1
  27. package/dist/user/user.service.d.ts +10 -0
  28. package/dist/user/user.service.d.ts.map +1 -1
  29. package/dist/user/user.service.js +7 -0
  30. package/dist/user/user.service.js.map +1 -1
  31. package/frontend/dashboard/components/create-panel.tsx.ejs +63 -63
  32. package/frontend/dashboard/components/dashboard.screen.tsx.ejs +116 -116
  33. package/frontend/dashboard/components/update-panel.tsx.ejs +80 -80
  34. package/frontend/dashboard/locales/en/dashboard.dashboard.json +11 -11
  35. package/frontend/dashboard/locales/pt/dashboard.dashboard.json +11 -11
  36. package/frontend/dashboard/react-query/handlers.ts.ejs +28 -28
  37. package/frontend/dashboard/react-query/requests.ts.ejs +56 -56
  38. package/frontend/dashboard-component/components/create-panel.tsx.ejs +130 -130
  39. package/frontend/dashboard-component/components/update-panel.tsx.ejs +164 -164
  40. package/frontend/dashboard-component/locales/en/dashboard.dashboard-component.json +11 -11
  41. package/frontend/dashboard-component/locales/pt/dashboard.dashboard-component.json +11 -11
  42. package/frontend/dashboard-component/react-query/handlers.ts.ejs +28 -28
  43. package/frontend/dashboard-component/react-query/requests.ts.ejs +61 -61
  44. package/frontend/dashboard-item/components/create-panel.tsx.ejs +108 -108
  45. package/frontend/dashboard-item/components/update-panel.tsx.ejs +141 -141
  46. package/frontend/dashboard-item/locales/en/dashboard.dashboard-item.json +11 -11
  47. package/frontend/dashboard-item/locales/pt/dashboard.dashboard-item.json +11 -11
  48. package/frontend/dashboard-item/react-query/handlers.ts.ejs +28 -28
  49. package/frontend/dashboard-item/react-query/requests.ts.ejs +58 -58
  50. package/frontend/dashboard-user/components/create-panel.tsx.ejs +108 -108
  51. package/frontend/dashboard-user/components/update-panel.tsx.ejs +137 -137
  52. package/frontend/dashboard-user/locales/en/dashboard.dashboard-user.json +11 -11
  53. package/frontend/dashboard-user/locales/pt/dashboard.dashboard-user.json +11 -11
  54. package/frontend/dashboard-user/react-query/handlers.ts.ejs +28 -28
  55. package/frontend/dashboard-user/react-query/requests.ts.ejs +58 -58
  56. package/hedhog.yaml +60 -0
  57. package/package.json +1 -1
  58. package/src/auth/auth.controller.ts +15 -0
  59. package/src/auth/auth.service.ts +28 -0
  60. package/src/auth/dto/register.dto.ts +38 -0
  61. package/src/dashboard/dashboard-component/dashboard-component.controller.ts +55 -55
  62. package/src/dashboard/dashboard-component/dto/create.dto.ts +36 -36
  63. package/src/dashboard/dashboard-component/dto/update.dto.ts +4 -4
  64. package/src/dashboard/dashboard-item/dto/update.dto.ts +4 -4
  65. package/src/dashboard/dashboard-user/dto/update.dto.ts +4 -4
  66. package/src/dashboard/index.ts +1 -1
  67. package/src/screen/screen.service.ts +2 -2
  68. package/src/setting/setting.service.ts +2 -2
  69. package/src/user/user.controller.ts +5 -0
  70. package/src/user/user.service.ts +9 -1
@@ -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
@@ -1,141 +1,141 @@
1
- import FormPanel, { FormPanelRef } from '@/components/panels/form-panel'
2
- import { Overlay } from '@/components/custom/overlay'
3
- import { TabPanel } from '@/components/panels/tab-panel'
4
- import {
5
- useDashboardItemGet,
6
- useDashboardItemUpdate,
7
- } from '@/features/admin/dashboard-item'
8
- import useEffectAfterFirstUpdate from '@/hooks/use-effect-after-first-update'
9
- import { DashboardItem } from '@/types/models'
10
- import { forwardRef, useImperativeHandle, useRef } from 'react'
11
- import { useTranslation } from 'react-i18next'
12
- import { EnumFieldType } from '@/enums/EnumFieldType'
13
-
14
- export type DashboardItemUpdatePanelProps = {
15
- data: DashboardItem
16
- onUpdated?: (data: DashboardItem) => void
17
- }
18
-
19
- const DashboardItemUpdatePanel = forwardRef(
20
- ({ data, onUpdated }: DashboardItemUpdatePanelProps, ref) => {
21
- const { t } = useTranslation(['actions', 'fields', 'translations'])
22
- const { data: item, isLoading } = useDashboardItemGet(
23
- (data as any).id as number
24
- )
25
- const { mutate: dashboardItemUpdate } = useDashboardItemUpdate()
26
- const formRef = useRef<FormPanelRef>(null)
27
-
28
- useEffectAfterFirstUpdate(() => {
29
- if (item && formRef.current) {
30
- formRef.current.setValuesFromItem(item)
31
- }
32
- }, [item])
33
-
34
- useImperativeHandle(ref, () => ({}))
35
-
36
- return (
37
- <TabPanel
38
- activeTabIndex={0}
39
- tabs={[
40
- {
41
- title: t('details', { ns: 'actions' }),
42
- children: (
43
- <Overlay loading={isLoading}>
44
- <FormPanel
45
- ref={formRef}
46
- fields={[
47
- {
48
- name: 'component_id',
49
- label: {
50
- text: t('dashboard-item.component_id', {
51
- ns: 'fields',
52
- }),
53
- },
54
- type: EnumFieldType.COMBOBOX,
55
- required: true,
56
- url: '/dashboard-component',
57
- displayName: 'component',
58
- valueName: 'id',
59
- },
60
-
61
- {
62
- name: 'dashboard_id',
63
- label: {
64
- text: t('dashboard-item.dashboard_id', {
65
- ns: 'fields',
66
- }),
67
- },
68
- type: EnumFieldType.COMBOBOX,
69
- required: true,
70
- url: '/dashboard',
71
- displayName: 'dashboard',
72
- valueName: 'id',
73
- },
74
-
75
- {
76
- name: 'width',
77
- label: {
78
- text: t('dashboard-user.width', { ns: 'fields' }),
79
- },
80
- type: EnumFieldType.NUMBER,
81
- required: true,
82
- },
83
-
84
- {
85
- name: 'height',
86
- label: {
87
- text: t('dashboard-user.height', { ns: 'fields' }),
88
- },
89
- type: EnumFieldType.NUMBER,
90
- required: true,
91
- },
92
-
93
- {
94
- name: 'x_axis',
95
- label: {
96
- text: t('dashboard-user.x_axis', { ns: 'fields' }),
97
- },
98
- type: EnumFieldType.NUMBER,
99
- required: true,
100
- },
101
-
102
- {
103
- name: 'y_axis',
104
- label: {
105
- text: t('dashboard-user.y_axis', { ns: 'fields' }),
106
- },
107
- type: EnumFieldType.NUMBER,
108
- required: true,
109
- },
110
- ]}
111
- button={{ text: t('save', { ns: 'actions' }) }}
112
- onSubmit={(data) => {
113
- dashboardItemUpdate({
114
- id: data.id,
115
- data: {
116
- ...data,
117
- component_id: Number(data.component_id),
118
- dashboard_id: Number(data.dashboard_id),
119
- width: Number(data.width),
120
- height: Number(data.height),
121
- x_axis: Number(data.x_axis),
122
- y_axis: Number(data.y_axis),
123
- },
124
- })
125
- if (typeof onUpdated === 'function') {
126
- onUpdated(data)
127
- }
128
- }}
129
- />
130
- </Overlay>
131
- ),
132
- },
133
- ]}
134
- />
135
- )
136
- }
137
- )
138
-
139
- DashboardItemUpdatePanel.displayName = 'DashboardItemUpdatePanel'
140
-
141
- export default DashboardItemUpdatePanel
1
+ import FormPanel, { FormPanelRef } from '@/components/panels/form-panel'
2
+ import { Overlay } from '@/components/custom/overlay'
3
+ import { TabPanel } from '@/components/panels/tab-panel'
4
+ import {
5
+ useDashboardItemGet,
6
+ useDashboardItemUpdate,
7
+ } from '@/features/admin/dashboard-item'
8
+ import useEffectAfterFirstUpdate from '@/hooks/use-effect-after-first-update'
9
+ import { DashboardItem } from '@/types/models'
10
+ import { forwardRef, useImperativeHandle, useRef } from 'react'
11
+ import { useTranslation } from 'react-i18next'
12
+ import { EnumFieldType } from '@/enums/EnumFieldType'
13
+
14
+ export type DashboardItemUpdatePanelProps = {
15
+ data: DashboardItem
16
+ onUpdated?: (data: DashboardItem) => void
17
+ }
18
+
19
+ const DashboardItemUpdatePanel = forwardRef(
20
+ ({ data, onUpdated }: DashboardItemUpdatePanelProps, ref) => {
21
+ const { t } = useTranslation(['actions', 'fields', 'translations'])
22
+ const { data: item, isLoading } = useDashboardItemGet(
23
+ (data as any).id as number
24
+ )
25
+ const { mutate: dashboardItemUpdate } = useDashboardItemUpdate()
26
+ const formRef = useRef<FormPanelRef>(null)
27
+
28
+ useEffectAfterFirstUpdate(() => {
29
+ if (item && formRef.current) {
30
+ formRef.current.setValuesFromItem(item)
31
+ }
32
+ }, [item])
33
+
34
+ useImperativeHandle(ref, () => ({}))
35
+
36
+ return (
37
+ <TabPanel
38
+ activeTabIndex={0}
39
+ tabs={[
40
+ {
41
+ title: t('details', { ns: 'actions' }),
42
+ children: (
43
+ <Overlay loading={isLoading}>
44
+ <FormPanel
45
+ ref={formRef}
46
+ fields={[
47
+ {
48
+ name: 'component_id',
49
+ label: {
50
+ text: t('dashboard-item.component_id', {
51
+ ns: 'fields',
52
+ }),
53
+ },
54
+ type: EnumFieldType.COMBOBOX,
55
+ required: true,
56
+ url: '/dashboard-component',
57
+ displayName: 'component',
58
+ valueName: 'id',
59
+ },
60
+
61
+ {
62
+ name: 'dashboard_id',
63
+ label: {
64
+ text: t('dashboard-item.dashboard_id', {
65
+ ns: 'fields',
66
+ }),
67
+ },
68
+ type: EnumFieldType.COMBOBOX,
69
+ required: true,
70
+ url: '/dashboard',
71
+ displayName: 'dashboard',
72
+ valueName: 'id',
73
+ },
74
+
75
+ {
76
+ name: 'width',
77
+ label: {
78
+ text: t('dashboard-user.width', { ns: 'fields' }),
79
+ },
80
+ type: EnumFieldType.NUMBER,
81
+ required: true,
82
+ },
83
+
84
+ {
85
+ name: 'height',
86
+ label: {
87
+ text: t('dashboard-user.height', { ns: 'fields' }),
88
+ },
89
+ type: EnumFieldType.NUMBER,
90
+ required: true,
91
+ },
92
+
93
+ {
94
+ name: 'x_axis',
95
+ label: {
96
+ text: t('dashboard-user.x_axis', { ns: 'fields' }),
97
+ },
98
+ type: EnumFieldType.NUMBER,
99
+ required: true,
100
+ },
101
+
102
+ {
103
+ name: 'y_axis',
104
+ label: {
105
+ text: t('dashboard-user.y_axis', { ns: 'fields' }),
106
+ },
107
+ type: EnumFieldType.NUMBER,
108
+ required: true,
109
+ },
110
+ ]}
111
+ button={{ text: t('save', { ns: 'actions' }) }}
112
+ onSubmit={(data) => {
113
+ dashboardItemUpdate({
114
+ id: data.id,
115
+ data: {
116
+ ...data,
117
+ component_id: Number(data.component_id),
118
+ dashboard_id: Number(data.dashboard_id),
119
+ width: Number(data.width),
120
+ height: Number(data.height),
121
+ x_axis: Number(data.x_axis),
122
+ y_axis: Number(data.y_axis),
123
+ },
124
+ })
125
+ if (typeof onUpdated === 'function') {
126
+ onUpdated(data)
127
+ }
128
+ }}
129
+ />
130
+ </Overlay>
131
+ ),
132
+ },
133
+ ]}
134
+ />
135
+ )
136
+ }
137
+ )
138
+
139
+ DashboardItemUpdatePanel.displayName = 'DashboardItemUpdatePanel'
140
+
141
+ export default DashboardItemUpdatePanel
@@ -1,11 +1,11 @@
1
- {
2
- "create": "Create dashboard item",
3
- "createText": "Fill the dashboard item informations.",
4
- "createTooltip": "Create new dashboard item",
5
- "delete": "Delete dashboard item",
6
- "deleteText": "Are you sure to delete these dashboard item?",
7
- "deleteTooltip": "Delete the selected dashboard item",
8
- "edit": "Edit dashboard item",
9
- "editText": "View and edit dashboard item information.",
10
- "editTooltip": "Edit the selected dashboard item"
11
- }
1
+ {
2
+ "create": "Create dashboard item",
3
+ "createText": "Fill the dashboard item informations.",
4
+ "createTooltip": "Create new dashboard item",
5
+ "delete": "Delete dashboard item",
6
+ "deleteText": "Are you sure to delete these dashboard item?",
7
+ "deleteTooltip": "Delete the selected dashboard item",
8
+ "edit": "Edit dashboard item",
9
+ "editText": "View and edit dashboard item information.",
10
+ "editTooltip": "Edit the selected dashboard item"
11
+ }
@@ -1,11 +1,11 @@
1
- {
2
- "create": "Criar item do painel",
3
- "createText": "Preencha as informações do item do painel.",
4
- "createTooltip": "Criar novo item do painel",
5
- "delete": "Excluir item do painel",
6
- "deleteText": "Você tem certeza que deseja excluir esses itens do painel?",
7
- "deleteTooltip": "Excluir o(s) item(ns) do painel selecionado(s)",
8
- "edit": "Editar item do painel",
9
- "editText": "Visualizar e editar informações do item do painel.",
10
- "editTooltip": "Editar o item do painel selecionado"
11
- }
1
+ {
2
+ "create": "Criar item do painel",
3
+ "createText": "Preencha as informações do item do painel.",
4
+ "createTooltip": "Criar novo item do painel",
5
+ "delete": "Excluir item do painel",
6
+ "deleteText": "Você tem certeza que deseja excluir esses itens do painel?",
7
+ "deleteTooltip": "Excluir o(s) item(ns) do painel selecionado(s)",
8
+ "edit": "Editar item do painel",
9
+ "editText": "Visualizar e editar informações do item do painel.",
10
+ "editTooltip": "Editar o item do painel selecionado"
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-item";
6
-
7
- export function useDashboardItemCreate() {
8
- const { dashboardItemCreate } = requests();
9
- return useDefaultMutation(scope, "create", dashboardItemCreate);
10
- }
11
-
12
- export function useDashboardItemDelete() {
13
- const { dashboardItemDelete } = requests();
14
- return useDefaultMutation(scope, "delete", dashboardItemDelete);
15
- }
16
-
17
- export function useDashboardItemUpdate() {
18
- const { dashboardItemUpdate } = requests();
19
- return useDefaultMutation(scope, "update", dashboardItemUpdate);
20
- }
21
-
22
- export function useDashboardItemGet(id: number) {
23
- const { dashboardItemGet } = requests();
24
- return useQuery({
25
- queryKey: [scope, "get"],
26
- queryFn: () => dashboardItemGet(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-item";
6
+
7
+ export function useDashboardItemCreate() {
8
+ const { dashboardItemCreate } = requests();
9
+ return useDefaultMutation(scope, "create", dashboardItemCreate);
10
+ }
11
+
12
+ export function useDashboardItemDelete() {
13
+ const { dashboardItemDelete } = requests();
14
+ return useDefaultMutation(scope, "delete", dashboardItemDelete);
15
+ }
16
+
17
+ export function useDashboardItemUpdate() {
18
+ const { dashboardItemUpdate } = requests();
19
+ return useDefaultMutation(scope, "update", dashboardItemUpdate);
20
+ }
21
+
22
+ export function useDashboardItemGet(id: number) {
23
+ const { dashboardItemGet } = requests();
24
+ return useQuery({
25
+ queryKey: [scope, "get"],
26
+ queryFn: () => dashboardItemGet(id),
27
+ });
28
+ }