@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,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
@@ -343,6 +343,66 @@ data:
343
343
  role:
344
344
  - where:
345
345
  slug: admin
346
+ - url: /setting/group/:slug
347
+ method: GET
348
+ relations:
349
+ role:
350
+ - where:
351
+ slug: admin
352
+ - url: /setting/user
353
+ method: GET
354
+ relations:
355
+ role:
356
+ - where:
357
+ slug: admin
358
+ - url: /setting
359
+ method: GET
360
+ relations:
361
+ role:
362
+ - where:
363
+ slug: admin
364
+ - url: /setting
365
+ method: POST
366
+ relations:
367
+ role:
368
+ - where:
369
+ slug: admin
370
+ - url: /setting/:settingId
371
+ method: GET
372
+ relations:
373
+ role:
374
+ - where:
375
+ slug: admin
376
+ - url: /setting/user/:slug
377
+ method: PUT
378
+ relations:
379
+ role:
380
+ - where:
381
+ slug: admin
382
+ - url: /setting/:slug
383
+ method: PUT
384
+ relations:
385
+ role:
386
+ - where:
387
+ slug: admin
388
+ - url: /setting
389
+ method: PUT
390
+ relations:
391
+ role:
392
+ - where:
393
+ slug: admin
394
+ - url: /setting
395
+ method: DELETE
396
+ relations:
397
+ role:
398
+ - where:
399
+ slug: admin
400
+ - url: /setting/:settingId
401
+ method: PATCH
402
+ relations:
403
+ role:
404
+ - where:
405
+ slug: admin
346
406
  setting_group:
347
407
  - slug: general
348
408
  icon: settings
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hedhog/admin",
3
- "version": "0.51.2",
3
+ "version": "0.51.4",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -15,6 +15,7 @@ import { EmailDTO } from './dto/email.dto';
15
15
  import { ForgetDTO } from './dto/forget.dto';
16
16
  import { LoginDTO } from './dto/login.dto';
17
17
  import { OtpDTO } from './dto/otp.dto';
18
+ import { RegisterDTO } from './dto/register.dto';
18
19
  import { ResetDTO } from './dto/reset.dto';
19
20
  import { User as UserType } from './types/user.type';
20
21
 
@@ -49,6 +50,20 @@ export class AuthController {
49
50
  return this.service.login({ email, password });
50
51
  }
51
52
 
53
+ @Public()
54
+ @Post('register')
55
+ async register(
56
+ @Body() { email, password, name, code, multifactor_id }: RegisterDTO,
57
+ ) {
58
+ return this.service.register({
59
+ email,
60
+ password,
61
+ name,
62
+ code,
63
+ multifactor_id,
64
+ });
65
+ }
66
+
52
67
  @Public()
53
68
  @Post('otp')
54
69
  async otp(@Body() { token, code }: OtpDTO) {
@@ -24,6 +24,7 @@ import { EmailDTO } from './dto/email.dto';
24
24
  import { ForgetDTO } from './dto/forget.dto';
25
25
  import { LoginDTO } from './dto/login.dto';
26
26
  import { OtpDTO } from './dto/otp.dto';
27
+ import { RegisterDTO } from './dto/register.dto';
27
28
  import { ResetDTO } from './dto/reset.dto';
28
29
  import { MultifactorType } from './enums/multifactor-type.enum';
29
30
 
@@ -64,6 +65,33 @@ export class AuthService {
64
65
  return user;
65
66
  }
66
67
 
68
+ async register({ email, name, password, code, multifactor_id }: RegisterDTO) {
69
+ const user = await this.prisma.user.findFirst({
70
+ where: {
71
+ email,
72
+ },
73
+ });
74
+
75
+ if (user) {
76
+ throw new ConflictException('Already exists a user with this email');
77
+ }
78
+
79
+ const salt = await genSalt();
80
+ password = await hash(password, salt);
81
+
82
+ const newUser = await this.prisma.user.create({
83
+ data: {
84
+ email,
85
+ name,
86
+ password,
87
+ multifactor_id,
88
+ code,
89
+ },
90
+ });
91
+
92
+ return this.getToken(newUser);
93
+ }
94
+
67
95
  async createUser({
68
96
  code,
69
97
  password,
@@ -0,0 +1,38 @@
1
+ import {
2
+ IsEmail,
3
+ IsInt,
4
+ IsOptional,
5
+ IsString,
6
+ IsStrongPassword,
7
+ } from 'class-validator';
8
+
9
+ export class RegisterDTO {
10
+ @IsEmail({}, { message: 'O e-mail informado não é válido.' })
11
+ email: string;
12
+
13
+ @IsStrongPassword(
14
+ {
15
+ minLength: 6,
16
+ minLowercase: 1,
17
+ minUppercase: 0,
18
+ minNumbers: 0,
19
+ minSymbols: 0,
20
+ },
21
+ {
22
+ message:
23
+ 'A senha deve ter pelo menos 6 caracteres e conter pelo menos 1 letra minúscula.',
24
+ },
25
+ )
26
+ password: string;
27
+
28
+ @IsString()
29
+ name: string;
30
+
31
+ @IsString()
32
+ @IsOptional()
33
+ code?: string;
34
+
35
+ @IsInt()
36
+ @IsOptional()
37
+ multifactor_id?: number;
38
+ }
@@ -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) {}
@@ -1 +1 @@
1
- export * from './dashboard.module';
1
+ export * from './dashboard.module';
@@ -18,7 +18,7 @@ export class ScreenService {
18
18
  private readonly prismaService: PrismaService,
19
19
  @Inject(forwardRef(() => PaginationService))
20
20
  private readonly paginationService: PaginationService,
21
- ) { }
21
+ ) {}
22
22
 
23
23
  async updateRoles(screenId: number, data: UpdateIdsDTO) {
24
24
  await this.prismaService.role_screen.deleteMany({
@@ -47,7 +47,7 @@ export class ScreenService {
47
47
  id: true,
48
48
  },
49
49
  })
50
- ).map((route) => route.id);
50
+ ).map((route) => route?.id);
51
51
 
52
52
  await this.prismaService.route_screen.deleteMany({
53
53
  where: {
@@ -343,11 +343,11 @@ export class SettingService {
343
343
  });
344
344
 
345
345
  const slugUserOverride = setting.filter((setting) => setting.user_override);
346
-
346
+
347
347
  const settingUser = await this.prismaService.setting_user.findMany({
348
348
  where: {
349
349
  setting_id: {
350
- in: slugUserOverride.map((setting) => setting.id),
350
+ in: slugUserOverride.map((setting) => setting?.id),
351
351
  },
352
352
  },
353
353
  select: {
@@ -52,6 +52,11 @@ export class UserController {
52
52
  return this.userService.get(userId);
53
53
  }
54
54
 
55
+ @Get('email/:email')
56
+ async getByEmail(@Param('email') email: string) {
57
+ return this.userService.getByEmail(email);
58
+ }
59
+
55
60
  @Post()
56
61
  create(@Body() data: CreateDTO) {
57
62
  return this.userService.create(data);
@@ -20,7 +20,7 @@ export class UserService {
20
20
  private readonly prismaService: PrismaService,
21
21
  @Inject(forwardRef(() => PaginationService))
22
22
  private readonly paginationService: PaginationService,
23
- ) { }
23
+ ) {}
24
24
 
25
25
  async listRoles(userId: number, paginationParams: PaginationDTO) {
26
26
  return this.paginationService.paginate(
@@ -99,6 +99,14 @@ export class UserService {
99
99
  });
100
100
  }
101
101
 
102
+ async getByEmail(email: string) {
103
+ return this.prismaService.user.findFirst({
104
+ where: {
105
+ email,
106
+ },
107
+ });
108
+ }
109
+
102
110
  async update({ id, data }: { id: number; data: UpdateDTO }) {
103
111
  return this.prismaService.user.update({
104
112
  where: { id },