@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-user";
6
-
7
- export function useDashboardUserCreate() {
8
- const { dashboardUserCreate } = requests();
9
- return useDefaultMutation(scope, "create", dashboardUserCreate);
10
- }
11
-
12
- export function useDashboardUserDelete() {
13
- const { dashboardUserDelete } = requests();
14
- return useDefaultMutation(scope, "delete", dashboardUserDelete);
15
- }
16
-
17
- export function useDashboardUserUpdate() {
18
- const { dashboardUserUpdate } = requests();
19
- return useDefaultMutation(scope, "update", dashboardUserUpdate);
20
- }
21
-
22
- export function useDashboardUserGet(id: number) {
23
- const { dashboardUserGet } = requests();
24
- return useQuery({
25
- queryKey: [scope, "get"],
26
- queryFn: () => dashboardUserGet(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-user";
6
+
7
+ export function useDashboardUserCreate() {
8
+ const { dashboardUserCreate } = requests();
9
+ return useDefaultMutation(scope, "create", dashboardUserCreate);
10
+ }
11
+
12
+ export function useDashboardUserDelete() {
13
+ const { dashboardUserDelete } = requests();
14
+ return useDefaultMutation(scope, "delete", dashboardUserDelete);
15
+ }
16
+
17
+ export function useDashboardUserUpdate() {
18
+ const { dashboardUserUpdate } = requests();
19
+ return useDefaultMutation(scope, "update", dashboardUserUpdate);
20
+ }
21
+
22
+ export function useDashboardUserGet(id: number) {
23
+ const { dashboardUserGet } = requests();
24
+ return useQuery({
25
+ queryKey: [scope, "get"],
26
+ queryFn: () => dashboardUserGet(id),
27
+ });
28
+ }
@@ -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
@@ -534,7 +534,7 @@ data:
534
534
  description:
535
535
  en: The scopes for Google OAuth
536
536
  pt: Os escopos para o OAuth do Google
537
- value: email,profile
537
+ value: '{["email","profile"]}'
538
538
  user_override: false
539
539
  - slug: facebook_client_id
540
540
  type: string
@@ -564,7 +564,7 @@ data:
564
564
  description:
565
565
  en: The scopes for Facebook OAuth
566
566
  pt: Os escopos para o OAuth do Facebook
567
- value: id,emails,name,displayName,photos
567
+ value: '{["id","emails","name","displayName","photos"]}'
568
568
  user_override: false
569
569
  menu:
570
570
  - url: /management/setting
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hedhog/admin",
3
- "version": "0.51.16",
3
+ "version": "0.51.21",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -27,29 +27,30 @@
27
27
  "devDependencies": {
28
28
  "@hedhog/locale": "^0.48.4",
29
29
  "@hedhog/mail": "^0.48.1",
30
+ "@hedhog/mail-manager": "^0.48.20",
30
31
  "@hedhog/pagination": "^0.46.1",
31
32
  "@hedhog/prisma": "^0.46.1",
32
33
  "@hedhog/utils": "^0.0.28",
33
34
  "@nestjs/config": "^4.0.1",
34
35
  "@nestjs/jwt": "^10.2.0",
35
36
  "@nestjs/mapped-types": "^2.1.0",
36
- "@types/passport-google-oauth20": "^2.0.16",
37
37
  "ts-node": "^10.9.1",
38
38
  "typescript": "^5.1.3"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@hedhog/locale": "latest",
42
42
  "@hedhog/mail": "latest",
43
+ "@hedhog/mail-manager": "latest",
43
44
  "@hedhog/pagination": "latest",
44
45
  "@hedhog/prisma": "latest",
45
46
  "@hedhog/utils": "latest",
46
47
  "@nestjs/jwt": "^10.2.0"
47
48
  },
48
49
  "dependencies": {
49
- "@nestjs/passport": "^11.0.5",
50
- "passport": "^0.7.0",
51
- "passport-google-oauth20": "^2.0.0",
50
+ "@nestjs/axios": "^4.0.0",
51
+ "axios": "^1.8.4",
52
52
  "qrcode": "^1.5.4",
53
- "speakeasy": "^2.0.0"
53
+ "speakeasy": "^2.0.0",
54
+ "uuid": "^11.1.0"
54
55
  }
55
56
  }
@@ -1,7 +1,9 @@
1
1
  import { LocaleModule } from '@hedhog/locale';
2
2
  import { MailModule } from '@hedhog/mail';
3
+ import { MailManagerModule } from '@hedhog/mail-manager';
3
4
  import { PaginationModule } from '@hedhog/pagination';
4
5
  import { PrismaModule } from '@hedhog/prisma';
6
+ import { HttpModule } from '@nestjs/axios';
5
7
  import { forwardRef, Module } from '@nestjs/common';
6
8
  import { ConfigModule } from '@nestjs/config';
7
9
  import { AuthModule } from './auth/auth.module';
@@ -16,10 +18,12 @@ import { UserModule } from './user/user.module';
16
18
 
17
19
  @Module({
18
20
  imports: [
21
+ HttpModule,
19
22
  ConfigModule.forRoot(),
20
23
  forwardRef(() => AuthModule),
21
24
  forwardRef(() => DashboardModule),
22
25
  forwardRef(() => MailModule),
26
+ forwardRef(() => MailManagerModule),
23
27
  forwardRef(() => MenuModule),
24
28
  forwardRef(() => PaginationModule),
25
29
  forwardRef(() => RoleModule),
@@ -35,6 +39,7 @@ import { UserModule } from './user/user.module';
35
39
  UserModule,
36
40
  AuthModule,
37
41
  MailModule,
42
+ MailManagerModule,
38
43
  RouteModule,
39
44
  RoleModule,
40
45
  MenuModule,
@@ -1,13 +1,15 @@
1
1
  import { Public, Role, User } from '@hedhog/core';
2
+ import { Locale } from '@hedhog/locale';
2
3
  import {
3
4
  Body,
4
5
  Controller,
6
+ Delete,
5
7
  forwardRef,
6
8
  Get,
7
9
  Inject,
8
10
  Post,
9
11
  Query,
10
- Delete,
12
+ Res,
11
13
  } from '@nestjs/common';
12
14
  import { AuthService } from './auth.service';
13
15
  import { ChangeDTO } from './dto/change.dto';
@@ -35,8 +37,8 @@ export class AuthController {
35
37
 
36
38
  @Public()
37
39
  @Post('create-user')
38
- async createUser(@Body() data: CreateUserDTO) {
39
- return this.service.createUser(data);
40
+ async createUser(@Locale() Locale, @Body() data: CreateUserDTO) {
41
+ return this.service.createUser(Locale, data);
40
42
  }
41
43
 
42
44
  @Role()
@@ -47,8 +49,8 @@ export class AuthController {
47
49
 
48
50
  @Public()
49
51
  @Post('login')
50
- async login(@Body() { email, password }: LoginDTO) {
51
- return this.service.login({ email, password });
52
+ async login(@Locale() locale: string, @Body() { email, password }: LoginDTO) {
53
+ return this.service.login(locale, { email, password });
52
54
  }
53
55
 
54
56
  @Public()
@@ -80,6 +82,7 @@ export class AuthController {
80
82
  @Public()
81
83
  @Post('forget')
82
84
  async forget(
85
+ @Locale() locale: string,
83
86
  @Body()
84
87
  {
85
88
  email,
@@ -88,15 +91,18 @@ export class AuthController {
88
91
  body: string;
89
92
  },
90
93
  ) {
91
- return this.service.forget({
94
+ return this.service.forget(locale, {
92
95
  email,
93
96
  });
94
97
  }
95
98
 
96
99
  @Public()
97
100
  @Post('reset')
98
- async reset(@Body() { newPassword, confirmNewPassword, code }: ResetDTO) {
99
- return this.service.resetPassword({
101
+ async reset(
102
+ @Locale() locale: string,
103
+ @Body() { newPassword, confirmNewPassword, code }: ResetDTO,
104
+ ) {
105
+ return this.service.resetPassword(locale, {
100
106
  newPassword,
101
107
  confirmNewPassword,
102
108
  code,
@@ -106,10 +112,11 @@ export class AuthController {
106
112
  @Public()
107
113
  @Post('change-password')
108
114
  async changePassword(
115
+ @Locale() locale: string,
109
116
  @Body()
110
117
  { email, currentPassword, newPassword, confirmNewPassword }: ChangeDTO,
111
118
  ) {
112
- return this.service.changePassword({
119
+ return this.service.changePassword(locale, {
113
120
  email,
114
121
  currentPassword,
115
122
  newPassword,
@@ -118,8 +125,15 @@ export class AuthController {
118
125
  }
119
126
 
120
127
  @Post('change-email')
121
- async changeEmail(@Body() { currentEmail, password, newEmail }: EmailDTO) {
122
- return this.service.changeEmail({ currentEmail, password, newEmail });
128
+ async changeEmail(
129
+ @Locale() locale: string,
130
+ @Body() { currentEmail, password, newEmail }: EmailDTO,
131
+ ) {
132
+ return this.service.changeEmail(locale, {
133
+ currentEmail,
134
+ password,
135
+ newEmail,
136
+ });
123
137
  }
124
138
 
125
139
  @Delete('mfa-remove')
@@ -137,4 +151,16 @@ export class AuthController {
137
151
  console.log('mfa-verify');
138
152
  return this.service.verifyMfa(id, token);
139
153
  }
154
+
155
+ @Public()
156
+ @Get('google/login')
157
+ async loginGoogle(@Res() res) {
158
+ return this.service.loginGoogle(res);
159
+ }
160
+
161
+ @Public()
162
+ @Get('google/callback')
163
+ async callbackGoogle(@Query() { code }: { code: string }) {
164
+ return this.service.callbackGoogle(code);
165
+ }
140
166
  }
@@ -1,5 +1,7 @@
1
1
  import { MailModule } from '@hedhog/mail';
2
+ import { MailManagerModule } from '@hedhog/mail-manager';
2
3
  import { PrismaModule } from '@hedhog/prisma';
4
+ import { HttpModule } from '@nestjs/axios';
3
5
  import { forwardRef, Module } from '@nestjs/common';
4
6
  import { ConfigModule } from '@nestjs/config';
5
7
  import { APP_GUARD } from '@nestjs/core';
@@ -27,8 +29,10 @@ import { AuthGuard } from './guards/auth.guard';
27
29
  ),
28
30
  forwardRef(() => PrismaModule),
29
31
  forwardRef(() => MailModule),
32
+ forwardRef(() => MailManagerModule),
30
33
  forwardRef(() => SettingModule),
31
34
  ConfigModule,
35
+ HttpModule,
32
36
  ],
33
37
  controllers: [AuthController],
34
38
  providers: [