@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,164 +1,164 @@
1
- import FormPanel, {
2
- FormPanelRef,
3
- getFieldsLocale,
4
- } from '@/components/panels/form-panel'
5
- import { Overlay } from '@/components/custom/overlay'
6
- import { TabPanel } from '@/components/panels/tab-panel'
7
- import {
8
- useDashboardComponentGet,
9
- useDashboardComponentUpdate,
10
- } from '@/features/admin/dashboard-component'
11
- import useEffectAfterFirstUpdate from '@/hooks/use-effect-after-first-update'
12
- import { DashboardComponent } from '@/types/models'
13
- import { forwardRef, useImperativeHandle, useRef } from 'react'
14
- import { useTranslation } from 'react-i18next'
15
- import { EnumFieldType } from '@/enums/EnumFieldType'
16
-
17
- export type DashboardComponentUpdatePanelProps = {
18
- data: DashboardComponent
19
- onUpdated?: (data: DashboardComponent) => void
20
- }
21
-
22
- const DashboardComponentUpdatePanel = forwardRef(
23
- ({ data, onUpdated }: DashboardComponentUpdatePanelProps, ref) => {
24
- const { t } = useTranslation(['actions', 'fields', 'translations'])
25
- const { data: item, isLoading } = useDashboardComponentGet(
26
- (data as any).component_id as number
27
- )
28
- const { mutate: dashboardComponentUpdate } = useDashboardComponentUpdate()
29
- const formRef = useRef<FormPanelRef>(null)
30
-
31
- useEffectAfterFirstUpdate(() => {
32
- if (item && formRef.current) {
33
- formRef.current.setValuesFromItem(item)
34
- }
35
- }, [item])
36
-
37
- useImperativeHandle(ref, () => ({}))
38
-
39
- return (
40
- <TabPanel
41
- activeTabIndex={0}
42
- tabs={[
43
- {
44
- title: t('details', { ns: 'actions' }),
45
- children: (
46
- <Overlay loading={isLoading}>
47
- <FormPanel
48
- ref={formRef}
49
- fields={[
50
- ...getFieldsLocale([{ name: 'name' }], item),
51
- {
52
- name: 'slug',
53
- label: {
54
- text: t('dashboard-component.slug', { ns: 'fields' }),
55
- },
56
- type: EnumFieldType.TEXT,
57
- required: true,
58
- },
59
- {
60
- name: 'path',
61
- label: {
62
- text: t('dashboard-component.path', { ns: 'fields' }),
63
- },
64
- type: EnumFieldType.TEXT,
65
- required: true,
66
- },
67
- {
68
- name: 'min_width',
69
- label: {
70
- text: t('dashboard-component.min_width', {
71
- ns: 'fields',
72
- }),
73
- },
74
- type: EnumFieldType.NUMBER,
75
- required: true,
76
- },
77
- {
78
- name: 'width',
79
- label: {
80
- text: t('dashboard-component.width', { ns: 'fields' }),
81
- },
82
- type: EnumFieldType.NUMBER,
83
- required: true,
84
- },
85
- {
86
- name: 'max_width',
87
- label: {
88
- text: t('dashboard-component.max_width', {
89
- ns: 'fields',
90
- }),
91
- },
92
- type: EnumFieldType.NUMBER,
93
- required: true,
94
- },
95
- {
96
- name: 'min_height',
97
- label: {
98
- text: t('dashboard-component.min_height', {
99
- ns: 'fields',
100
- }),
101
- },
102
- type: EnumFieldType.NUMBER,
103
- required: true,
104
- },
105
- {
106
- name: 'height',
107
- label: {
108
- text: t('dashboard-component.height', { ns: 'fields' }),
109
- },
110
- type: EnumFieldType.NUMBER,
111
- required: true,
112
- },
113
- {
114
- name: 'max_height',
115
- label: {
116
- text: t('dashboard-component.max_height', {
117
- ns: 'fields',
118
- }),
119
- },
120
- type: EnumFieldType.NUMBER,
121
- required: true,
122
- },
123
- {
124
- name: 'is_resizable',
125
- label: {
126
- text: t('dashboard-component.is_resizable', {
127
- ns: 'fields',
128
- }),
129
- },
130
- type: EnumFieldType.SWITCH,
131
- required: true,
132
- },
133
- ]}
134
- button={{ text: t('save', { ns: 'actions' }) }}
135
- onSubmit={(data) => {
136
- dashboardComponentUpdate({
137
- id: data.id,
138
- data: {
139
- ...data,
140
- min_width: Number(data.min_width),
141
- width: Number(data.width),
142
- max_width: Number(data.max_width),
143
- min_height: Number(data.min_height),
144
- height: Number(data.height),
145
- max_height: Number(data.max_height),
146
- },
147
- })
148
- if (typeof onUpdated === 'function') {
149
- onUpdated(data)
150
- }
151
- }}
152
- />
153
- </Overlay>
154
- ),
155
- },
156
- ]}
157
- />
158
- )
159
- }
160
- )
161
-
162
- DashboardComponentUpdatePanel.displayName = 'DashboardComponentUpdatePanel'
163
-
164
- export default DashboardComponentUpdatePanel
1
+ import FormPanel, {
2
+ FormPanelRef,
3
+ getFieldsLocale,
4
+ } from '@/components/panels/form-panel'
5
+ import { Overlay } from '@/components/custom/overlay'
6
+ import { TabPanel } from '@/components/panels/tab-panel'
7
+ import {
8
+ useDashboardComponentGet,
9
+ useDashboardComponentUpdate,
10
+ } from '@/features/admin/dashboard-component'
11
+ import useEffectAfterFirstUpdate from '@/hooks/use-effect-after-first-update'
12
+ import { DashboardComponent } from '@/types/models'
13
+ import { forwardRef, useImperativeHandle, useRef } from 'react'
14
+ import { useTranslation } from 'react-i18next'
15
+ import { EnumFieldType } from '@/enums/EnumFieldType'
16
+
17
+ export type DashboardComponentUpdatePanelProps = {
18
+ data: DashboardComponent
19
+ onUpdated?: (data: DashboardComponent) => void
20
+ }
21
+
22
+ const DashboardComponentUpdatePanel = forwardRef(
23
+ ({ data, onUpdated }: DashboardComponentUpdatePanelProps, ref) => {
24
+ const { t } = useTranslation(['actions', 'fields', 'translations'])
25
+ const { data: item, isLoading } = useDashboardComponentGet(
26
+ (data as any).component_id as number
27
+ )
28
+ const { mutate: dashboardComponentUpdate } = useDashboardComponentUpdate()
29
+ const formRef = useRef<FormPanelRef>(null)
30
+
31
+ useEffectAfterFirstUpdate(() => {
32
+ if (item && formRef.current) {
33
+ formRef.current.setValuesFromItem(item)
34
+ }
35
+ }, [item])
36
+
37
+ useImperativeHandle(ref, () => ({}))
38
+
39
+ return (
40
+ <TabPanel
41
+ activeTabIndex={0}
42
+ tabs={[
43
+ {
44
+ title: t('details', { ns: 'actions' }),
45
+ children: (
46
+ <Overlay loading={isLoading}>
47
+ <FormPanel
48
+ ref={formRef}
49
+ fields={[
50
+ ...getFieldsLocale([{ name: 'name' }], item),
51
+ {
52
+ name: 'slug',
53
+ label: {
54
+ text: t('dashboard-component.slug', { ns: 'fields' }),
55
+ },
56
+ type: EnumFieldType.TEXT,
57
+ required: true,
58
+ },
59
+ {
60
+ name: 'path',
61
+ label: {
62
+ text: t('dashboard-component.path', { ns: 'fields' }),
63
+ },
64
+ type: EnumFieldType.TEXT,
65
+ required: true,
66
+ },
67
+ {
68
+ name: 'min_width',
69
+ label: {
70
+ text: t('dashboard-component.min_width', {
71
+ ns: 'fields',
72
+ }),
73
+ },
74
+ type: EnumFieldType.NUMBER,
75
+ required: true,
76
+ },
77
+ {
78
+ name: 'width',
79
+ label: {
80
+ text: t('dashboard-component.width', { ns: 'fields' }),
81
+ },
82
+ type: EnumFieldType.NUMBER,
83
+ required: true,
84
+ },
85
+ {
86
+ name: 'max_width',
87
+ label: {
88
+ text: t('dashboard-component.max_width', {
89
+ ns: 'fields',
90
+ }),
91
+ },
92
+ type: EnumFieldType.NUMBER,
93
+ required: true,
94
+ },
95
+ {
96
+ name: 'min_height',
97
+ label: {
98
+ text: t('dashboard-component.min_height', {
99
+ ns: 'fields',
100
+ }),
101
+ },
102
+ type: EnumFieldType.NUMBER,
103
+ required: true,
104
+ },
105
+ {
106
+ name: 'height',
107
+ label: {
108
+ text: t('dashboard-component.height', { ns: 'fields' }),
109
+ },
110
+ type: EnumFieldType.NUMBER,
111
+ required: true,
112
+ },
113
+ {
114
+ name: 'max_height',
115
+ label: {
116
+ text: t('dashboard-component.max_height', {
117
+ ns: 'fields',
118
+ }),
119
+ },
120
+ type: EnumFieldType.NUMBER,
121
+ required: true,
122
+ },
123
+ {
124
+ name: 'is_resizable',
125
+ label: {
126
+ text: t('dashboard-component.is_resizable', {
127
+ ns: 'fields',
128
+ }),
129
+ },
130
+ type: EnumFieldType.SWITCH,
131
+ required: true,
132
+ },
133
+ ]}
134
+ button={{ text: t('save', { ns: 'actions' }) }}
135
+ onSubmit={(data) => {
136
+ dashboardComponentUpdate({
137
+ id: data.id,
138
+ data: {
139
+ ...data,
140
+ min_width: Number(data.min_width),
141
+ width: Number(data.width),
142
+ max_width: Number(data.max_width),
143
+ min_height: Number(data.min_height),
144
+ height: Number(data.height),
145
+ max_height: Number(data.max_height),
146
+ },
147
+ })
148
+ if (typeof onUpdated === 'function') {
149
+ onUpdated(data)
150
+ }
151
+ }}
152
+ />
153
+ </Overlay>
154
+ ),
155
+ },
156
+ ]}
157
+ />
158
+ )
159
+ }
160
+ )
161
+
162
+ DashboardComponentUpdatePanel.displayName = 'DashboardComponentUpdatePanel'
163
+
164
+ export default DashboardComponentUpdatePanel
@@ -1,11 +1,11 @@
1
- {
2
- "create": "Create dashboard component",
3
- "createText": "Fill the dashboard component informations.",
4
- "createTooltip": "Create new dashboard component",
5
- "delete": "Delete dashboard component",
6
- "deleteText": "Are you sure to delete these dashboard components?",
7
- "deleteTooltip": "Delete the selected dashboard component",
8
- "edit": "Edit dashboard component",
9
- "editText": "View and edit dashboard component information.",
10
- "editTooltip": "Edit the selected dashboard component"
11
- }
1
+ {
2
+ "create": "Create dashboard component",
3
+ "createText": "Fill the dashboard component informations.",
4
+ "createTooltip": "Create new dashboard component",
5
+ "delete": "Delete dashboard component",
6
+ "deleteText": "Are you sure to delete these dashboard components?",
7
+ "deleteTooltip": "Delete the selected dashboard component",
8
+ "edit": "Edit dashboard component",
9
+ "editText": "View and edit dashboard component information.",
10
+ "editTooltip": "Edit the selected dashboard component"
11
+ }
@@ -1,11 +1,11 @@
1
- {
2
- "create": "Criar componente do dashboard",
3
- "createText": "Preencha as informações do componente do dashboard.",
4
- "createTooltip": "Criar novo componente do dashboard",
5
- "delete": "Excluir componente do dashboard",
6
- "deleteText": "Você tem certeza de que deseja excluir esses componentes do dashboard?",
7
- "deleteTooltip": "Excluir o componente do dashboard selecionado",
8
- "edit": "Editar componente do dashboard",
9
- "editText": "Ver e editar as informações do componente do dashboard.",
10
- "editTooltip": "Editar o componente do dashboard selecionado"
11
- }
1
+ {
2
+ "create": "Criar componente do dashboard",
3
+ "createText": "Preencha as informações do componente do dashboard.",
4
+ "createTooltip": "Criar novo componente do dashboard",
5
+ "delete": "Excluir componente do dashboard",
6
+ "deleteText": "Você tem certeza de que deseja excluir esses componentes do dashboard?",
7
+ "deleteTooltip": "Excluir o componente do dashboard selecionado",
8
+ "edit": "Editar componente do dashboard",
9
+ "editText": "Ver e editar as informações do componente do dashboard.",
10
+ "editTooltip": "Editar o componente do dashboard 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-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
+ }