@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.
- package/dist/admin.module.d.ts.map +1 -1
- package/dist/admin.module.js +3 -1
- package/dist/admin.module.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/setting/dto/create.dto.d.ts +9 -0
- package/dist/setting/dto/create.dto.d.ts.map +1 -0
- package/dist/setting/dto/create.dto.js +40 -0
- package/dist/setting/dto/create.dto.js.map +1 -0
- package/dist/setting/dto/delete.dto.d.ts +4 -0
- package/dist/setting/dto/delete.dto.d.ts.map +1 -0
- package/dist/setting/dto/delete.dto.js +23 -0
- package/dist/setting/dto/delete.dto.js.map +1 -0
- package/dist/setting/dto/setting-user.dto.d.ts +4 -0
- package/dist/setting/dto/setting-user.dto.d.ts.map +1 -0
- package/dist/setting/dto/setting-user.dto.js +21 -0
- package/dist/setting/dto/setting-user.dto.js.map +1 -0
- package/dist/setting/dto/setting.dto.d.ts +9 -0
- package/dist/setting/dto/setting.dto.d.ts.map +1 -0
- package/dist/setting/dto/setting.dto.js +34 -0
- package/dist/setting/dto/setting.dto.js.map +1 -0
- package/dist/setting/dto/update.dto.d.ts +6 -0
- package/dist/setting/dto/update.dto.d.ts.map +1 -0
- package/dist/setting/dto/update.dto.js +9 -0
- package/dist/setting/dto/update.dto.js.map +1 -0
- package/dist/setting/setting.controller.d.ts +102 -0
- package/dist/setting/setting.controller.d.ts.map +1 -0
- package/dist/setting/setting.controller.js +160 -0
- package/dist/setting/setting.controller.js.map +1 -0
- package/dist/setting/setting.module.d.ts +3 -0
- package/dist/setting/setting.module.d.ts.map +1 -0
- package/dist/setting/setting.module.js +24 -0
- package/dist/setting/setting.module.js.map +1 -0
- package/dist/setting/setting.service.d.ts +103 -0
- package/dist/setting/setting.service.d.ts.map +1 -0
- package/dist/setting/setting.service.js +333 -0
- package/dist/setting/setting.service.js.map +1 -0
- package/frontend/dashboard/components/create-panel.tsx.ejs +63 -63
- package/frontend/dashboard/components/dashboard.screen.tsx.ejs +116 -116
- package/frontend/dashboard/components/update-panel.tsx.ejs +80 -80
- package/frontend/dashboard/locales/en/dashboard.dashboard.json +11 -11
- package/frontend/dashboard/locales/pt/dashboard.dashboard.json +11 -11
- package/frontend/dashboard/react-query/handlers.ts.ejs +28 -28
- package/frontend/dashboard/react-query/requests.ts.ejs +56 -56
- package/frontend/dashboard-component/components/create-panel.tsx.ejs +130 -130
- package/frontend/dashboard-component/components/update-panel.tsx.ejs +164 -164
- package/frontend/dashboard-component/locales/en/dashboard.dashboard-component.json +11 -11
- package/frontend/dashboard-component/locales/pt/dashboard.dashboard-component.json +11 -11
- package/frontend/dashboard-component/react-query/handlers.ts.ejs +28 -28
- package/frontend/dashboard-component/react-query/requests.ts.ejs +61 -61
- package/frontend/dashboard-item/components/create-panel.tsx.ejs +108 -108
- package/frontend/dashboard-item/components/update-panel.tsx.ejs +141 -141
- package/frontend/dashboard-item/locales/en/dashboard.dashboard-item.json +11 -11
- package/frontend/dashboard-item/locales/pt/dashboard.dashboard-item.json +11 -11
- package/frontend/dashboard-item/react-query/handlers.ts.ejs +28 -28
- package/frontend/dashboard-item/react-query/requests.ts.ejs +58 -58
- package/frontend/dashboard-user/components/create-panel.tsx.ejs +108 -108
- package/frontend/dashboard-user/components/update-panel.tsx.ejs +137 -137
- package/frontend/dashboard-user/locales/en/dashboard.dashboard-user.json +11 -11
- package/frontend/dashboard-user/locales/pt/dashboard.dashboard-user.json +11 -11
- package/frontend/dashboard-user/react-query/handlers.ts.ejs +28 -28
- package/frontend/dashboard-user/react-query/requests.ts.ejs +58 -58
- package/hedhog.yaml +244 -0
- package/package.json +1 -1
- package/src/admin.module.ts +3 -1
- package/src/dashboard/dashboard-component/dashboard-component.controller.ts +55 -55
- package/src/dashboard/dashboard-component/dto/create.dto.ts +36 -36
- package/src/dashboard/dashboard-component/dto/update.dto.ts +4 -4
- package/src/dashboard/dashboard-item/dto/update.dto.ts +4 -4
- package/src/dashboard/dashboard-user/dto/update.dto.ts +4 -4
- package/src/dashboard/index.ts +1 -1
- package/src/index.ts +2 -0
- package/src/setting/dto/create.dto.ts +21 -0
- package/src/setting/dto/delete.dto.ts +8 -0
- package/src/setting/dto/setting-user.dto.ts +6 -0
- package/src/setting/dto/setting.dto.ts +17 -0
- package/src/setting/dto/update.dto.ts +4 -0
- package/src/setting/setting.controller.ts +105 -0
- package/src/setting/setting.module.ts +11 -0
- package/src/setting/setting.service.ts +400 -0
@@ -1,58 +1,58 @@
|
|
1
|
-
import { useApp } from "@/hooks/use-app";
|
2
|
-
import { Delete, PaginationParams, PaginationResult } from "@/types";
|
3
|
-
import { DashboardUser } from "@/types/models";
|
4
|
-
import { HttpMethod } from "@/types/http-method";
|
5
|
-
|
6
|
-
export function requests() {
|
7
|
-
const { request } = useApp();
|
8
|
-
|
9
|
-
const dashboardUserList = async (params: PaginationParams) => {
|
10
|
-
return request<PaginationResult<DashboardUser>>({
|
11
|
-
url: "/dashboard-user",
|
12
|
-
params,
|
13
|
-
}).then((res) => res.data);
|
14
|
-
};
|
15
|
-
|
16
|
-
const dashboardUserGet = async (id: number) => {
|
17
|
-
return request<DashboardUser>({
|
18
|
-
url: `/dashboard-user/${id}`,
|
19
|
-
}).then((res) => res.data);
|
20
|
-
};
|
21
|
-
|
22
|
-
const dashboardUserCreate = async (params: { data: DashboardUser }) => {
|
23
|
-
const { data } = params;
|
24
|
-
return request<DashboardUser>({
|
25
|
-
url: "/dashboard-user",
|
26
|
-
method: HttpMethod.POST,
|
27
|
-
data: data,
|
28
|
-
}).then((res) => res.data);
|
29
|
-
};
|
30
|
-
|
31
|
-
const dashboardUserDelete = async (ids: number[]) => {
|
32
|
-
return request<Delete>({
|
33
|
-
url: "/dashboard-user",
|
34
|
-
data: { ids },
|
35
|
-
method: HttpMethod.DELETE,
|
36
|
-
}).then((res) => res.data);
|
37
|
-
};
|
38
|
-
|
39
|
-
const dashboardUserUpdate = async (params: {
|
40
|
-
id: number;
|
41
|
-
data: DashboardUser;
|
42
|
-
}) => {
|
43
|
-
const { id, data } = params;
|
44
|
-
return request<DashboardUser>({
|
45
|
-
url: `/dashboard-user/${id}`,
|
46
|
-
method: HttpMethod.PATCH,
|
47
|
-
data: data,
|
48
|
-
}).then((res) => res.data);
|
49
|
-
};
|
50
|
-
|
51
|
-
return {
|
52
|
-
dashboardUserCreate,
|
53
|
-
dashboardUserUpdate,
|
54
|
-
dashboardUserDelete,
|
55
|
-
dashboardUserList,
|
56
|
-
dashboardUserGet,
|
57
|
-
};
|
58
|
-
}
|
1
|
+
import { useApp } from "@/hooks/use-app";
|
2
|
+
import { Delete, PaginationParams, PaginationResult } from "@/types";
|
3
|
+
import { DashboardUser } from "@/types/models";
|
4
|
+
import { HttpMethod } from "@/types/http-method";
|
5
|
+
|
6
|
+
export function requests() {
|
7
|
+
const { request } = useApp();
|
8
|
+
|
9
|
+
const dashboardUserList = async (params: PaginationParams) => {
|
10
|
+
return request<PaginationResult<DashboardUser>>({
|
11
|
+
url: "/dashboard-user",
|
12
|
+
params,
|
13
|
+
}).then((res) => res.data);
|
14
|
+
};
|
15
|
+
|
16
|
+
const dashboardUserGet = async (id: number) => {
|
17
|
+
return request<DashboardUser>({
|
18
|
+
url: `/dashboard-user/${id}`,
|
19
|
+
}).then((res) => res.data);
|
20
|
+
};
|
21
|
+
|
22
|
+
const dashboardUserCreate = async (params: { data: DashboardUser }) => {
|
23
|
+
const { data } = params;
|
24
|
+
return request<DashboardUser>({
|
25
|
+
url: "/dashboard-user",
|
26
|
+
method: HttpMethod.POST,
|
27
|
+
data: data,
|
28
|
+
}).then((res) => res.data);
|
29
|
+
};
|
30
|
+
|
31
|
+
const dashboardUserDelete = async (ids: number[]) => {
|
32
|
+
return request<Delete>({
|
33
|
+
url: "/dashboard-user",
|
34
|
+
data: { ids },
|
35
|
+
method: HttpMethod.DELETE,
|
36
|
+
}).then((res) => res.data);
|
37
|
+
};
|
38
|
+
|
39
|
+
const dashboardUserUpdate = async (params: {
|
40
|
+
id: number;
|
41
|
+
data: DashboardUser;
|
42
|
+
}) => {
|
43
|
+
const { id, data } = params;
|
44
|
+
return request<DashboardUser>({
|
45
|
+
url: `/dashboard-user/${id}`,
|
46
|
+
method: HttpMethod.PATCH,
|
47
|
+
data: data,
|
48
|
+
}).then((res) => res.data);
|
49
|
+
};
|
50
|
+
|
51
|
+
return {
|
52
|
+
dashboardUserCreate,
|
53
|
+
dashboardUserUpdate,
|
54
|
+
dashboardUserDelete,
|
55
|
+
dashboardUserList,
|
56
|
+
dashboardUserGet,
|
57
|
+
};
|
58
|
+
}
|
package/hedhog.yaml
CHANGED
@@ -343,7 +343,101 @@ data:
|
|
343
343
|
role:
|
344
344
|
- where:
|
345
345
|
slug: admin
|
346
|
+
setting_group:
|
347
|
+
- slug: general
|
348
|
+
icon: settings
|
349
|
+
name:
|
350
|
+
en: General
|
351
|
+
pt: Geral
|
352
|
+
description:
|
353
|
+
en: General settings and configurations.
|
354
|
+
pt: Configurações e definições gerais.
|
355
|
+
relations:
|
356
|
+
setting:
|
357
|
+
- slug: url
|
358
|
+
type: string
|
359
|
+
name:
|
360
|
+
en: Base URL
|
361
|
+
pt: URL Base
|
362
|
+
description:
|
363
|
+
en: The base URL of the system
|
364
|
+
pt: A URL base do sistema
|
365
|
+
value: http://localhost:3200
|
366
|
+
user_override: false
|
367
|
+
- slug: localization
|
368
|
+
icon: world
|
369
|
+
name:
|
370
|
+
en: Localization
|
371
|
+
pt: Localização
|
372
|
+
description:
|
373
|
+
en: Configure the localization setting.
|
374
|
+
pt: Configurar as definições de localização.
|
375
|
+
relations:
|
376
|
+
setting:
|
377
|
+
- slug: language
|
378
|
+
type: string
|
379
|
+
name:
|
380
|
+
en: Default Language
|
381
|
+
pt: Idioma Padrão
|
382
|
+
description:
|
383
|
+
en: The system default language, each user can have their own preferred language
|
384
|
+
pt:
|
385
|
+
O idioma padrão do sistema, cada usuário pode ter o seu próprio idioma
|
386
|
+
preferido
|
387
|
+
value: en
|
388
|
+
user_override: true
|
389
|
+
- slug: timezone
|
390
|
+
type: string
|
391
|
+
name:
|
392
|
+
en: Timezone
|
393
|
+
pt: Fuso Horário
|
394
|
+
description:
|
395
|
+
en: The timezone to use
|
396
|
+
pt: O fuso horário a utilizar
|
397
|
+
value: UTC
|
398
|
+
user_override: true
|
346
399
|
menu:
|
400
|
+
- url: /management/setting
|
401
|
+
icon: settings
|
402
|
+
name:
|
403
|
+
en: Setting
|
404
|
+
pt: Configurações
|
405
|
+
slug: /management/setting
|
406
|
+
- menu_id:
|
407
|
+
where:
|
408
|
+
slug: /management
|
409
|
+
slug: /settings
|
410
|
+
icon: settings
|
411
|
+
name:
|
412
|
+
en: Settings
|
413
|
+
pt: Configurações
|
414
|
+
- menu_id:
|
415
|
+
where:
|
416
|
+
slug: /settings
|
417
|
+
name:
|
418
|
+
en: Setting Group
|
419
|
+
pt: Grupo de Configuração
|
420
|
+
icon: settings
|
421
|
+
url: /settings/setting-group
|
422
|
+
slug: /settings/setting-group
|
423
|
+
- menu_id:
|
424
|
+
where:
|
425
|
+
slug: /settings
|
426
|
+
name:
|
427
|
+
en: Setting User
|
428
|
+
pt: Configuração de Usuário
|
429
|
+
icon: user-cog
|
430
|
+
url: /settings/setting-user
|
431
|
+
slug: /settings/setting-user
|
432
|
+
- menu_id:
|
433
|
+
where:
|
434
|
+
slug: /settings
|
435
|
+
name:
|
436
|
+
en: Locale
|
437
|
+
pt: Locale
|
438
|
+
icon: world
|
439
|
+
url: /settings/locale
|
440
|
+
slug: /settings/locale
|
347
441
|
- url: /
|
348
442
|
icon: dashboard
|
349
443
|
name:
|
@@ -454,6 +548,48 @@ data:
|
|
454
548
|
- where:
|
455
549
|
slug: admin
|
456
550
|
screen:
|
551
|
+
- slug: /management/setting
|
552
|
+
icon: settings
|
553
|
+
name:
|
554
|
+
en: Setting
|
555
|
+
pt: Configurações
|
556
|
+
description:
|
557
|
+
en: Manage system setting and configurations.
|
558
|
+
pt: Gerenciar configurações e definições do sistema.
|
559
|
+
relations:
|
560
|
+
route:
|
561
|
+
- where:
|
562
|
+
url:
|
563
|
+
like: /setting%
|
564
|
+
- name:
|
565
|
+
en: Setting Group
|
566
|
+
pt: Grupo de Configuração
|
567
|
+
slug: /settings/setting-group
|
568
|
+
description:
|
569
|
+
en: Screen to manage a group of settings
|
570
|
+
pt: Tela para gerenciar grupo de configurações
|
571
|
+
icon: settings
|
572
|
+
- name:
|
573
|
+
en: Setting User
|
574
|
+
pt: Configuração de Usuário
|
575
|
+
slug: /settings/setting-user
|
576
|
+
description:
|
577
|
+
en: Screen to manage user settings
|
578
|
+
pt: Tela para gerenciar configurações de usuário
|
579
|
+
icon: user-cog
|
580
|
+
- name:
|
581
|
+
en: Locale
|
582
|
+
pt: Locale
|
583
|
+
slug: /settings/locale
|
584
|
+
description:
|
585
|
+
en: Screen to manage locale
|
586
|
+
pt: Tela para gerenciar localização/tradução
|
587
|
+
icon: world
|
588
|
+
relations:
|
589
|
+
route:
|
590
|
+
- where:
|
591
|
+
url:
|
592
|
+
like: /locale%
|
457
593
|
- slug: /management/user
|
458
594
|
icon: user
|
459
595
|
name:
|
@@ -673,6 +809,114 @@ data:
|
|
673
809
|
name: pt
|
674
810
|
value: Português
|
675
811
|
tables:
|
812
|
+
setting_group:
|
813
|
+
columns:
|
814
|
+
- type: pk
|
815
|
+
- name: icon
|
816
|
+
length: 31
|
817
|
+
- type: slug
|
818
|
+
- type: created_at
|
819
|
+
- type: updated_at
|
820
|
+
ifNotExists: true
|
821
|
+
setting_group_locale:
|
822
|
+
columns:
|
823
|
+
- name: locale_id
|
824
|
+
type: fk
|
825
|
+
isPrimary: true
|
826
|
+
references:
|
827
|
+
table: locale
|
828
|
+
column: id
|
829
|
+
onDelete: CASCADE
|
830
|
+
- name: group_id
|
831
|
+
type: fk
|
832
|
+
isPrimary: true
|
833
|
+
references:
|
834
|
+
table: setting_group
|
835
|
+
column: id
|
836
|
+
onDelete: CASCADE
|
837
|
+
- name: name
|
838
|
+
length: 63
|
839
|
+
- name: description
|
840
|
+
length: 255
|
841
|
+
isNullable: true
|
842
|
+
- type: created_at
|
843
|
+
- type: updated_at
|
844
|
+
ifNotExists: true
|
845
|
+
setting:
|
846
|
+
columns:
|
847
|
+
- type: pk
|
848
|
+
- name: group_id
|
849
|
+
type: fk
|
850
|
+
references:
|
851
|
+
table: setting_group
|
852
|
+
column: id
|
853
|
+
onDelete: CASCADE
|
854
|
+
- type: slug
|
855
|
+
- name: type
|
856
|
+
type: enum
|
857
|
+
enum:
|
858
|
+
- string
|
859
|
+
- array
|
860
|
+
- number
|
861
|
+
- boolean
|
862
|
+
- json
|
863
|
+
default: string
|
864
|
+
- name: value
|
865
|
+
length: 1023
|
866
|
+
isNullable: true
|
867
|
+
- name: user_override
|
868
|
+
type: boolean
|
869
|
+
default: false
|
870
|
+
- type: created_at
|
871
|
+
- type: updated_at
|
872
|
+
ifNotExists: true
|
873
|
+
setting_locale:
|
874
|
+
columns:
|
875
|
+
- name: locale_id
|
876
|
+
type: fk
|
877
|
+
isPrimary: true
|
878
|
+
references:
|
879
|
+
table: locale
|
880
|
+
column: id
|
881
|
+
onDelete: CASCADE
|
882
|
+
- name: setting_id
|
883
|
+
type: fk
|
884
|
+
isPrimary: true
|
885
|
+
references:
|
886
|
+
table: setting
|
887
|
+
column: id
|
888
|
+
onDelete: CASCADE
|
889
|
+
- name: description
|
890
|
+
length: 255
|
891
|
+
isNullable: true
|
892
|
+
- name: name
|
893
|
+
length: 63
|
894
|
+
isNullable: true
|
895
|
+
- type: created_at
|
896
|
+
- type: updated_at
|
897
|
+
ifNotExists: true
|
898
|
+
setting_user:
|
899
|
+
columns:
|
900
|
+
- name: user_id
|
901
|
+
type: fk
|
902
|
+
isPrimary: true
|
903
|
+
references:
|
904
|
+
table: user
|
905
|
+
column: id
|
906
|
+
onDelete: CASCADE
|
907
|
+
- name: setting_id
|
908
|
+
type: fk
|
909
|
+
isPrimary: true
|
910
|
+
references:
|
911
|
+
table: setting
|
912
|
+
column: id
|
913
|
+
onDelete: CASCADE
|
914
|
+
- name: value
|
915
|
+
length: 1023
|
916
|
+
isNullable: true
|
917
|
+
- type: created_at
|
918
|
+
- type: updated_at
|
919
|
+
ifNotExists: true
|
676
920
|
translation_namespace:
|
677
921
|
columns:
|
678
922
|
- type: pk
|
package/package.json
CHANGED
package/src/admin.module.ts
CHANGED
@@ -5,12 +5,13 @@ import { PrismaModule } from '@hedhog/prisma';
|
|
5
5
|
import { forwardRef, Module } from '@nestjs/common';
|
6
6
|
import { ConfigModule } from '@nestjs/config';
|
7
7
|
import { AuthModule } from './auth/auth.module';
|
8
|
-
import { DashboardModule } from './dashboard/dashboard.module';
|
9
8
|
import { CoreModule } from './core/core.module';
|
9
|
+
import { DashboardModule } from './dashboard/dashboard.module';
|
10
10
|
import { MenuModule } from './menu/menu.module';
|
11
11
|
import { RoleModule } from './role/role.module';
|
12
12
|
import { RouteModule } from './route/route.module';
|
13
13
|
import { ScreenModule } from './screen/screen.module';
|
14
|
+
import { SettingModule } from './setting/setting.module';
|
14
15
|
import { UserModule } from './user/user.module';
|
15
16
|
|
16
17
|
@Module({
|
@@ -28,6 +29,7 @@ import { UserModule } from './user/user.module';
|
|
28
29
|
forwardRef(() => LocaleModule),
|
29
30
|
forwardRef(() => UserModule),
|
30
31
|
forwardRef(() => CoreModule),
|
32
|
+
forwardRef(() => SettingModule),
|
31
33
|
],
|
32
34
|
exports: [
|
33
35
|
UserModule,
|
@@ -1,55 +1,55 @@
|
|
1
|
-
import { Pagination } from '@hedhog/pagination';
|
2
|
-
import { Locale } from '@hedhog/locale';
|
3
|
-
import {
|
4
|
-
Body,
|
5
|
-
Controller,
|
6
|
-
Delete,
|
7
|
-
Get,
|
8
|
-
Inject,
|
9
|
-
Param,
|
10
|
-
ParseIntPipe,
|
11
|
-
Patch,
|
12
|
-
Post,
|
13
|
-
forwardRef
|
14
|
-
} from '@nestjs/common';
|
15
|
-
import { CreateDTO } from './dto/create.dto';
|
16
|
-
import { UpdateDTO } from './dto/update.dto';
|
17
|
-
import { DashboardComponentService } from './dashboard-component.service';
|
18
|
-
import { Role, DeleteDTO } from '@hedhog/core';
|
19
|
-
|
20
|
-
@Role()
|
21
|
-
@Controller('dashboard-component')
|
22
|
-
export class DashboardComponentController {
|
23
|
-
constructor(
|
24
|
-
@Inject(forwardRef(() => DashboardComponentService))
|
25
|
-
private readonly dashboardComponentService: DashboardComponentService
|
26
|
-
) {}
|
27
|
-
|
28
|
-
@Get()
|
29
|
-
async list(@Locale() locale, @Pagination() paginationParams) {
|
30
|
-
return this.dashboardComponentService.list(locale, paginationParams);
|
31
|
-
}
|
32
|
-
|
33
|
-
@Get(':id')
|
34
|
-
async get(@Param('id', ParseIntPipe) id: number) {
|
35
|
-
return this.dashboardComponentService.get(id);
|
36
|
-
}
|
37
|
-
|
38
|
-
@Post()
|
39
|
-
async create(@Body() data: CreateDTO) {
|
40
|
-
return this.dashboardComponentService.create(data);
|
41
|
-
}
|
42
|
-
|
43
|
-
@Patch(':id')
|
44
|
-
async update(@Param('id', ParseIntPipe) id: number, @Body() data: UpdateDTO) {
|
45
|
-
return this.dashboardComponentService.update({
|
46
|
-
id,
|
47
|
-
data
|
48
|
-
});
|
49
|
-
}
|
50
|
-
|
51
|
-
@Delete()
|
52
|
-
async delete(@Body() data: DeleteDTO) {
|
53
|
-
return this.dashboardComponentService.delete(data);
|
54
|
-
}
|
55
|
-
}
|
1
|
+
import { Pagination } from '@hedhog/pagination';
|
2
|
+
import { Locale } from '@hedhog/locale';
|
3
|
+
import {
|
4
|
+
Body,
|
5
|
+
Controller,
|
6
|
+
Delete,
|
7
|
+
Get,
|
8
|
+
Inject,
|
9
|
+
Param,
|
10
|
+
ParseIntPipe,
|
11
|
+
Patch,
|
12
|
+
Post,
|
13
|
+
forwardRef
|
14
|
+
} from '@nestjs/common';
|
15
|
+
import { CreateDTO } from './dto/create.dto';
|
16
|
+
import { UpdateDTO } from './dto/update.dto';
|
17
|
+
import { DashboardComponentService } from './dashboard-component.service';
|
18
|
+
import { Role, DeleteDTO } from '@hedhog/core';
|
19
|
+
|
20
|
+
@Role()
|
21
|
+
@Controller('dashboard-component')
|
22
|
+
export class DashboardComponentController {
|
23
|
+
constructor(
|
24
|
+
@Inject(forwardRef(() => DashboardComponentService))
|
25
|
+
private readonly dashboardComponentService: DashboardComponentService
|
26
|
+
) {}
|
27
|
+
|
28
|
+
@Get()
|
29
|
+
async list(@Locale() locale, @Pagination() paginationParams) {
|
30
|
+
return this.dashboardComponentService.list(locale, paginationParams);
|
31
|
+
}
|
32
|
+
|
33
|
+
@Get(':id')
|
34
|
+
async get(@Param('id', ParseIntPipe) id: number) {
|
35
|
+
return this.dashboardComponentService.get(id);
|
36
|
+
}
|
37
|
+
|
38
|
+
@Post()
|
39
|
+
async create(@Body() data: CreateDTO) {
|
40
|
+
return this.dashboardComponentService.create(data);
|
41
|
+
}
|
42
|
+
|
43
|
+
@Patch(':id')
|
44
|
+
async update(@Param('id', ParseIntPipe) id: number, @Body() data: UpdateDTO) {
|
45
|
+
return this.dashboardComponentService.update({
|
46
|
+
id,
|
47
|
+
data
|
48
|
+
});
|
49
|
+
}
|
50
|
+
|
51
|
+
@Delete()
|
52
|
+
async delete(@Body() data: DeleteDTO) {
|
53
|
+
return this.dashboardComponentService.delete(data);
|
54
|
+
}
|
55
|
+
}
|
@@ -1,36 +1,36 @@
|
|
1
|
-
import { IsString, IsNumber, IsBoolean, IsOptional } from 'class-validator';
|
2
|
-
import { WithLocaleDTO } from '@hedhog/locale';
|
3
|
-
|
4
|
-
export class CreateDTO extends WithLocaleDTO {
|
5
|
-
@IsString()
|
6
|
-
slug: string;
|
7
|
-
|
8
|
-
@IsString()
|
9
|
-
path: string;
|
10
|
-
|
11
|
-
@IsOptional()
|
12
|
-
@IsNumber()
|
13
|
-
min_width?: number;
|
14
|
-
|
15
|
-
@IsOptional()
|
16
|
-
@IsNumber()
|
17
|
-
max_width?: number;
|
18
|
-
|
19
|
-
@IsOptional()
|
20
|
-
@IsNumber()
|
21
|
-
min_height?: number;
|
22
|
-
|
23
|
-
@IsOptional()
|
24
|
-
@IsNumber()
|
25
|
-
max_height?: number;
|
26
|
-
|
27
|
-
@IsNumber()
|
28
|
-
width: number;
|
29
|
-
|
30
|
-
@IsNumber()
|
31
|
-
height: number;
|
32
|
-
|
33
|
-
@IsOptional()
|
34
|
-
@IsBoolean()
|
35
|
-
is_resizable?: boolean;
|
36
|
-
}
|
1
|
+
import { IsString, IsNumber, IsBoolean, IsOptional } from 'class-validator';
|
2
|
+
import { WithLocaleDTO } from '@hedhog/locale';
|
3
|
+
|
4
|
+
export class CreateDTO extends WithLocaleDTO {
|
5
|
+
@IsString()
|
6
|
+
slug: string;
|
7
|
+
|
8
|
+
@IsString()
|
9
|
+
path: string;
|
10
|
+
|
11
|
+
@IsOptional()
|
12
|
+
@IsNumber()
|
13
|
+
min_width?: number;
|
14
|
+
|
15
|
+
@IsOptional()
|
16
|
+
@IsNumber()
|
17
|
+
max_width?: number;
|
18
|
+
|
19
|
+
@IsOptional()
|
20
|
+
@IsNumber()
|
21
|
+
min_height?: number;
|
22
|
+
|
23
|
+
@IsOptional()
|
24
|
+
@IsNumber()
|
25
|
+
max_height?: number;
|
26
|
+
|
27
|
+
@IsNumber()
|
28
|
+
width: number;
|
29
|
+
|
30
|
+
@IsNumber()
|
31
|
+
height: number;
|
32
|
+
|
33
|
+
@IsOptional()
|
34
|
+
@IsBoolean()
|
35
|
+
is_resizable?: boolean;
|
36
|
+
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { PartialType } from '@nestjs/mapped-types';
|
2
|
-
import { CreateDTO } from './create.dto';
|
3
|
-
|
4
|
-
export class UpdateDTO extends PartialType(CreateDTO) {}
|
1
|
+
import { PartialType } from '@nestjs/mapped-types';
|
2
|
+
import { CreateDTO } from './create.dto';
|
3
|
+
|
4
|
+
export class UpdateDTO extends PartialType(CreateDTO) {}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { PartialType } from '@nestjs/mapped-types';
|
2
|
-
import { CreateDTO } from './create.dto';
|
3
|
-
|
4
|
-
export class UpdateDTO extends PartialType(CreateDTO) {}
|
1
|
+
import { PartialType } from '@nestjs/mapped-types';
|
2
|
+
import { CreateDTO } from './create.dto';
|
3
|
+
|
4
|
+
export class UpdateDTO extends PartialType(CreateDTO) {}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { PartialType } from '@nestjs/mapped-types';
|
2
|
-
import { CreateDTO } from './create.dto';
|
3
|
-
|
4
|
-
export class UpdateDTO extends PartialType(CreateDTO) {}
|
1
|
+
import { PartialType } from '@nestjs/mapped-types';
|
2
|
+
import { CreateDTO } from './create.dto';
|
3
|
+
|
4
|
+
export class UpdateDTO extends PartialType(CreateDTO) {}
|
package/src/dashboard/index.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export * from './dashboard.module';
|
1
|
+
export * from './dashboard.module';
|
package/src/index.ts
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
import { IsString, IsInt, Length, IsBoolean } from 'class-validator';
|
2
|
+
import { WithLocaleDTO } from '@hedhog/locale';
|
3
|
+
|
4
|
+
export class CreateDTO extends WithLocaleDTO {
|
5
|
+
@IsString()
|
6
|
+
@Length(0, 255)
|
7
|
+
slug: string;
|
8
|
+
|
9
|
+
@IsString()
|
10
|
+
type: string;
|
11
|
+
|
12
|
+
@IsString()
|
13
|
+
@Length(0, 1023)
|
14
|
+
value: string;
|
15
|
+
|
16
|
+
@IsBoolean()
|
17
|
+
user_override: boolean;
|
18
|
+
|
19
|
+
@IsInt()
|
20
|
+
group_id: number;
|
21
|
+
}
|