@hedhog/admin 0.11.1 → 0.12.2
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/{hedhog.yaml → bkp.hedhog.yaml} +1012 -814
- package/dist/auth/consts/body.js +23 -23
- package/package.json +43 -43
- package/src/admin.module.ts +37 -37
- package/src/auth/auth.controller.ts +72 -72
- package/src/auth/auth.module.ts +39 -39
- package/src/auth/auth.service.spec.ts +196 -196
- package/src/auth/auth.service.ts +234 -234
- package/src/auth/consts/body.ts +26 -26
- package/src/auth/consts/subject.ts +1 -1
- package/src/auth/dto/forget.dto.ts +6 -6
- package/src/auth/dto/login.dto.ts +15 -15
- package/src/auth/dto/otp.dto.ts +11 -11
- package/src/auth/dto/reset.dto.ts +14 -14
- package/src/auth/enums/multifactor-type.enum.ts +4 -4
- package/src/auth/guards/auth.guard.ts +50 -50
- package/src/auth/types/user.type.ts +8 -8
- package/src/dto/delete.dto.ts +8 -8
- package/src/dto/update-ids.dto.ts +9 -9
- package/src/index.ts +20 -20
- package/src/menu/dto/create.dto.ts +25 -25
- package/src/menu/dto/order.dto.ts +8 -8
- package/src/menu/dto/update.dto.ts +19 -19
- package/src/menu/menu.controller.ts +105 -105
- package/src/menu/menu.module.ts +18 -18
- package/src/menu/menu.service.spec.ts +247 -247
- package/src/menu/menu.service.ts +263 -263
- package/src/role/dto/create.dto.ts +7 -7
- package/src/role/dto/update.dto.ts +4 -4
- package/src/role/guards/role.guard.ts +123 -123
- package/src/role/role.controller.ts +126 -126
- package/src/role/role.module.ts +28 -28
- package/src/role/role.service.spec.ts +417 -417
- package/src/role/role.service.ts +289 -289
- package/src/route/dto/create.dto.ts +13 -13
- package/src/route/dto/update.dto.ts +15 -15
- package/src/route/route.controller.ts +91 -91
- package/src/route/route.module.ts +18 -18
- package/src/route/route.service.spec.ts +300 -300
- package/src/route/route.service.ts +164 -164
- package/src/screen/dto/create.dto.ts +11 -11
- package/src/screen/dto/update.dto.ts +19 -19
- package/src/screen/screen.controller.ts +93 -93
- package/src/screen/screen.module.ts +18 -18
- package/src/screen/screen.service.spec.ts +298 -298
- package/src/screen/screen.service.ts +179 -179
- package/src/types/http-method.ts +8 -8
- package/src/user/constants/user.constants.ts +1 -1
- package/src/user/dto/create.dto.ts +24 -24
- package/src/user/dto/update.dto.ts +41 -41
- package/src/user/user.controller.ts +75 -75
- package/src/user/user.module.ts +18 -18
- package/src/user/user.service.spec.ts +294 -294
- package/src/user/user.service.ts +129 -129
@@ -1,164 +1,164 @@
|
|
1
|
-
import { PaginationDTO, PaginationService } from '@hedhog/pagination';
|
2
|
-
import { PrismaService } from '@hedhog/prisma';
|
3
|
-
import { forwardRef, Inject, Injectable } from '@nestjs/common';
|
4
|
-
import { DeleteDTO } from '../dto/delete.dto';
|
5
|
-
import { UpdateIdsDTO } from '../dto/update-ids.dto';
|
6
|
-
import { CreateDTO } from './dto/create.dto';
|
7
|
-
import { UpdateDTO } from './dto/update.dto';
|
8
|
-
|
9
|
-
@Injectable()
|
10
|
-
export class RouteService {
|
11
|
-
constructor(
|
12
|
-
@Inject(forwardRef(() => PrismaService))
|
13
|
-
private readonly prismaService: PrismaService,
|
14
|
-
@Inject(forwardRef(() => PaginationService))
|
15
|
-
private readonly paginationService: PaginationService,
|
16
|
-
) {}
|
17
|
-
|
18
|
-
async list(paginationParams: PaginationDTO) {
|
19
|
-
const fields = ['url', 'method'];
|
20
|
-
|
21
|
-
const OR: any[] = this.prismaService.createInsensitiveSearch(
|
22
|
-
fields,
|
23
|
-
paginationParams,
|
24
|
-
);
|
25
|
-
|
26
|
-
return this.paginationService.paginate(
|
27
|
-
this.prismaService.route,
|
28
|
-
paginationParams,
|
29
|
-
{
|
30
|
-
where: {
|
31
|
-
OR,
|
32
|
-
},
|
33
|
-
},
|
34
|
-
);
|
35
|
-
}
|
36
|
-
|
37
|
-
async get(routeId: number) {
|
38
|
-
return this.prismaService.route.findUnique({ where: { id: routeId } });
|
39
|
-
}
|
40
|
-
|
41
|
-
async create({ url, method }: CreateDTO) {
|
42
|
-
return this.prismaService.route.create({ data: { url, method } });
|
43
|
-
}
|
44
|
-
|
45
|
-
async update({ id, data }: { id: number; data: UpdateDTO }) {
|
46
|
-
return this.prismaService.route.update({
|
47
|
-
where: { id },
|
48
|
-
data,
|
49
|
-
});
|
50
|
-
}
|
51
|
-
|
52
|
-
async delete({ ids }: DeleteDTO) {
|
53
|
-
return this.prismaService.route.deleteMany({
|
54
|
-
where: {
|
55
|
-
id: {
|
56
|
-
in: ids,
|
57
|
-
},
|
58
|
-
},
|
59
|
-
});
|
60
|
-
}
|
61
|
-
|
62
|
-
async listRoles(
|
63
|
-
locale: string,
|
64
|
-
routeId: number,
|
65
|
-
paginationParams: PaginationDTO,
|
66
|
-
) {
|
67
|
-
return this.paginationService.paginate(
|
68
|
-
this.prismaService.role,
|
69
|
-
paginationParams,
|
70
|
-
{
|
71
|
-
include: {
|
72
|
-
role_locale: {
|
73
|
-
where: {
|
74
|
-
locale: {
|
75
|
-
code: locale,
|
76
|
-
},
|
77
|
-
},
|
78
|
-
select: {
|
79
|
-
name: true,
|
80
|
-
description: true,
|
81
|
-
},
|
82
|
-
},
|
83
|
-
role_route: {
|
84
|
-
where: {
|
85
|
-
route_id: routeId,
|
86
|
-
},
|
87
|
-
select: {
|
88
|
-
route_id: true,
|
89
|
-
role_id: true,
|
90
|
-
},
|
91
|
-
},
|
92
|
-
},
|
93
|
-
},
|
94
|
-
'role_locale',
|
95
|
-
);
|
96
|
-
}
|
97
|
-
|
98
|
-
async updateRoles(routeId: number, data: UpdateIdsDTO) {
|
99
|
-
await this.prismaService.role_route.deleteMany({
|
100
|
-
where: {
|
101
|
-
route_id: routeId,
|
102
|
-
},
|
103
|
-
});
|
104
|
-
|
105
|
-
return this.prismaService.role_route.createMany({
|
106
|
-
data: data.ids.map((roleId) => ({
|
107
|
-
role_id: roleId,
|
108
|
-
route_id: routeId,
|
109
|
-
})),
|
110
|
-
skipDuplicates: true,
|
111
|
-
});
|
112
|
-
}
|
113
|
-
|
114
|
-
async listScreens(
|
115
|
-
locale: string,
|
116
|
-
routeId: number,
|
117
|
-
paginationParams: PaginationDTO,
|
118
|
-
) {
|
119
|
-
return this.paginationService.paginate(
|
120
|
-
this.prismaService.screen,
|
121
|
-
paginationParams,
|
122
|
-
{
|
123
|
-
include: {
|
124
|
-
screen_locale: {
|
125
|
-
where: {
|
126
|
-
locale: {
|
127
|
-
code: locale,
|
128
|
-
},
|
129
|
-
},
|
130
|
-
select: {
|
131
|
-
name: true,
|
132
|
-
},
|
133
|
-
},
|
134
|
-
route_screen: {
|
135
|
-
where: {
|
136
|
-
route_id: routeId,
|
137
|
-
},
|
138
|
-
select: {
|
139
|
-
route_id: true,
|
140
|
-
screen_id: true,
|
141
|
-
},
|
142
|
-
},
|
143
|
-
},
|
144
|
-
},
|
145
|
-
'screen_locale',
|
146
|
-
);
|
147
|
-
}
|
148
|
-
|
149
|
-
async updateScreens(routeId: number, data: UpdateIdsDTO) {
|
150
|
-
await this.prismaService.route_screen.deleteMany({
|
151
|
-
where: {
|
152
|
-
route_id: routeId,
|
153
|
-
},
|
154
|
-
});
|
155
|
-
|
156
|
-
return this.prismaService.route_screen.createMany({
|
157
|
-
data: data.ids.map((screenId) => ({
|
158
|
-
screen_id: screenId,
|
159
|
-
route_id: routeId,
|
160
|
-
})),
|
161
|
-
skipDuplicates: true,
|
162
|
-
});
|
163
|
-
}
|
164
|
-
}
|
1
|
+
import { PaginationDTO, PaginationService } from '@hedhog/pagination';
|
2
|
+
import { PrismaService } from '@hedhog/prisma';
|
3
|
+
import { forwardRef, Inject, Injectable } from '@nestjs/common';
|
4
|
+
import { DeleteDTO } from '../dto/delete.dto';
|
5
|
+
import { UpdateIdsDTO } from '../dto/update-ids.dto';
|
6
|
+
import { CreateDTO } from './dto/create.dto';
|
7
|
+
import { UpdateDTO } from './dto/update.dto';
|
8
|
+
|
9
|
+
@Injectable()
|
10
|
+
export class RouteService {
|
11
|
+
constructor(
|
12
|
+
@Inject(forwardRef(() => PrismaService))
|
13
|
+
private readonly prismaService: PrismaService,
|
14
|
+
@Inject(forwardRef(() => PaginationService))
|
15
|
+
private readonly paginationService: PaginationService,
|
16
|
+
) {}
|
17
|
+
|
18
|
+
async list(paginationParams: PaginationDTO) {
|
19
|
+
const fields = ['url', 'method'];
|
20
|
+
|
21
|
+
const OR: any[] = this.prismaService.createInsensitiveSearch(
|
22
|
+
fields,
|
23
|
+
paginationParams,
|
24
|
+
);
|
25
|
+
|
26
|
+
return this.paginationService.paginate(
|
27
|
+
this.prismaService.route,
|
28
|
+
paginationParams,
|
29
|
+
{
|
30
|
+
where: {
|
31
|
+
OR,
|
32
|
+
},
|
33
|
+
},
|
34
|
+
);
|
35
|
+
}
|
36
|
+
|
37
|
+
async get(routeId: number) {
|
38
|
+
return this.prismaService.route.findUnique({ where: { id: routeId } });
|
39
|
+
}
|
40
|
+
|
41
|
+
async create({ url, method }: CreateDTO) {
|
42
|
+
return this.prismaService.route.create({ data: { url, method } });
|
43
|
+
}
|
44
|
+
|
45
|
+
async update({ id, data }: { id: number; data: UpdateDTO }) {
|
46
|
+
return this.prismaService.route.update({
|
47
|
+
where: { id },
|
48
|
+
data,
|
49
|
+
});
|
50
|
+
}
|
51
|
+
|
52
|
+
async delete({ ids }: DeleteDTO) {
|
53
|
+
return this.prismaService.route.deleteMany({
|
54
|
+
where: {
|
55
|
+
id: {
|
56
|
+
in: ids,
|
57
|
+
},
|
58
|
+
},
|
59
|
+
});
|
60
|
+
}
|
61
|
+
|
62
|
+
async listRoles(
|
63
|
+
locale: string,
|
64
|
+
routeId: number,
|
65
|
+
paginationParams: PaginationDTO,
|
66
|
+
) {
|
67
|
+
return this.paginationService.paginate(
|
68
|
+
this.prismaService.role,
|
69
|
+
paginationParams,
|
70
|
+
{
|
71
|
+
include: {
|
72
|
+
role_locale: {
|
73
|
+
where: {
|
74
|
+
locale: {
|
75
|
+
code: locale,
|
76
|
+
},
|
77
|
+
},
|
78
|
+
select: {
|
79
|
+
name: true,
|
80
|
+
description: true,
|
81
|
+
},
|
82
|
+
},
|
83
|
+
role_route: {
|
84
|
+
where: {
|
85
|
+
route_id: routeId,
|
86
|
+
},
|
87
|
+
select: {
|
88
|
+
route_id: true,
|
89
|
+
role_id: true,
|
90
|
+
},
|
91
|
+
},
|
92
|
+
},
|
93
|
+
},
|
94
|
+
'role_locale',
|
95
|
+
);
|
96
|
+
}
|
97
|
+
|
98
|
+
async updateRoles(routeId: number, data: UpdateIdsDTO) {
|
99
|
+
await this.prismaService.role_route.deleteMany({
|
100
|
+
where: {
|
101
|
+
route_id: routeId,
|
102
|
+
},
|
103
|
+
});
|
104
|
+
|
105
|
+
return this.prismaService.role_route.createMany({
|
106
|
+
data: data.ids.map((roleId) => ({
|
107
|
+
role_id: roleId,
|
108
|
+
route_id: routeId,
|
109
|
+
})),
|
110
|
+
skipDuplicates: true,
|
111
|
+
});
|
112
|
+
}
|
113
|
+
|
114
|
+
async listScreens(
|
115
|
+
locale: string,
|
116
|
+
routeId: number,
|
117
|
+
paginationParams: PaginationDTO,
|
118
|
+
) {
|
119
|
+
return this.paginationService.paginate(
|
120
|
+
this.prismaService.screen,
|
121
|
+
paginationParams,
|
122
|
+
{
|
123
|
+
include: {
|
124
|
+
screen_locale: {
|
125
|
+
where: {
|
126
|
+
locale: {
|
127
|
+
code: locale,
|
128
|
+
},
|
129
|
+
},
|
130
|
+
select: {
|
131
|
+
name: true,
|
132
|
+
},
|
133
|
+
},
|
134
|
+
route_screen: {
|
135
|
+
where: {
|
136
|
+
route_id: routeId,
|
137
|
+
},
|
138
|
+
select: {
|
139
|
+
route_id: true,
|
140
|
+
screen_id: true,
|
141
|
+
},
|
142
|
+
},
|
143
|
+
},
|
144
|
+
},
|
145
|
+
'screen_locale',
|
146
|
+
);
|
147
|
+
}
|
148
|
+
|
149
|
+
async updateScreens(routeId: number, data: UpdateIdsDTO) {
|
150
|
+
await this.prismaService.route_screen.deleteMany({
|
151
|
+
where: {
|
152
|
+
route_id: routeId,
|
153
|
+
},
|
154
|
+
});
|
155
|
+
|
156
|
+
return this.prismaService.route_screen.createMany({
|
157
|
+
data: data.ids.map((screenId) => ({
|
158
|
+
screen_id: screenId,
|
159
|
+
route_id: routeId,
|
160
|
+
})),
|
161
|
+
skipDuplicates: true,
|
162
|
+
});
|
163
|
+
}
|
164
|
+
}
|
@@ -1,11 +1,11 @@
|
|
1
|
-
import { IsNotEmpty, IsString } from 'class-validator';
|
2
|
-
|
3
|
-
export class CreateDTO {
|
4
|
-
@IsString({ message: 'O slug deve ser uma string' })
|
5
|
-
@IsNotEmpty({ message: 'O slug é obrigatório.' })
|
6
|
-
slug: string;
|
7
|
-
|
8
|
-
@IsString({ message: 'O ícone deve ser uma string' })
|
9
|
-
@IsNotEmpty({ message: 'A descrição é obrigatória.' })
|
10
|
-
icon?: string;
|
11
|
-
}
|
1
|
+
import { IsNotEmpty, IsString } from 'class-validator';
|
2
|
+
|
3
|
+
export class CreateDTO {
|
4
|
+
@IsString({ message: 'O slug deve ser uma string' })
|
5
|
+
@IsNotEmpty({ message: 'O slug é obrigatório.' })
|
6
|
+
slug: string;
|
7
|
+
|
8
|
+
@IsString({ message: 'O ícone deve ser uma string' })
|
9
|
+
@IsNotEmpty({ message: 'A descrição é obrigatória.' })
|
10
|
+
icon?: string;
|
11
|
+
}
|
@@ -1,19 +1,19 @@
|
|
1
|
-
import { IsOptional, IsString } from 'class-validator';
|
2
|
-
|
3
|
-
export class UpdateDTO {
|
4
|
-
@IsOptional()
|
5
|
-
@IsString({ message: 'O nome deve ser uma string' })
|
6
|
-
name?: string;
|
7
|
-
|
8
|
-
@IsOptional()
|
9
|
-
@IsString({ message: 'O slug deve ser uma string' })
|
10
|
-
slug?: string;
|
11
|
-
|
12
|
-
@IsOptional()
|
13
|
-
@IsString({ message: 'A descrição deve ser uma string' })
|
14
|
-
description?: string;
|
15
|
-
|
16
|
-
@IsOptional()
|
17
|
-
@IsString({ message: 'O ícone deve ser uma string' })
|
18
|
-
icon?: string;
|
19
|
-
}
|
1
|
+
import { IsOptional, IsString } from 'class-validator';
|
2
|
+
|
3
|
+
export class UpdateDTO {
|
4
|
+
@IsOptional()
|
5
|
+
@IsString({ message: 'O nome deve ser uma string' })
|
6
|
+
name?: string;
|
7
|
+
|
8
|
+
@IsOptional()
|
9
|
+
@IsString({ message: 'O slug deve ser uma string' })
|
10
|
+
slug?: string;
|
11
|
+
|
12
|
+
@IsOptional()
|
13
|
+
@IsString({ message: 'A descrição deve ser uma string' })
|
14
|
+
description?: string;
|
15
|
+
|
16
|
+
@IsOptional()
|
17
|
+
@IsString({ message: 'O ícone deve ser uma string' })
|
18
|
+
icon?: string;
|
19
|
+
}
|
@@ -1,93 +1,93 @@
|
|
1
|
-
import { Pagination } from '@hedhog/pagination';
|
2
|
-
import {
|
3
|
-
Body,
|
4
|
-
Controller,
|
5
|
-
Delete,
|
6
|
-
Get,
|
7
|
-
Inject,
|
8
|
-
Param,
|
9
|
-
ParseIntPipe,
|
10
|
-
Patch,
|
11
|
-
Post,
|
12
|
-
forwardRef,
|
13
|
-
} from '@nestjs/common';
|
14
|
-
import { DeleteDTO } from '../dto/delete.dto';
|
15
|
-
import { UpdateIdsDTO } from '../dto/update-ids.dto';
|
16
|
-
import { Locale } from '@hedhog/locale';
|
17
|
-
import { Role } from '@hedhog/core';
|
18
|
-
import { CreateDTO } from './dto/create.dto';
|
19
|
-
import { UpdateDTO } from './dto/update.dto';
|
20
|
-
import { ScreenService } from './screen.service';
|
21
|
-
|
22
|
-
@Role()
|
23
|
-
@Controller('screen')
|
24
|
-
export class ScreenController {
|
25
|
-
constructor(
|
26
|
-
@Inject(forwardRef(() => ScreenService))
|
27
|
-
private readonly screenService: ScreenService,
|
28
|
-
) {}
|
29
|
-
|
30
|
-
@Get()
|
31
|
-
async list(@Pagination() paginationParams, @Locale() locale) {
|
32
|
-
return this.screenService.list(locale, paginationParams);
|
33
|
-
}
|
34
|
-
|
35
|
-
@Get(':screenId/role')
|
36
|
-
async listRoles(
|
37
|
-
@Param('screenId', ParseIntPipe) screenId: number,
|
38
|
-
@Pagination() paginationParams,
|
39
|
-
@Locale() locale,
|
40
|
-
) {
|
41
|
-
return this.screenService.listRoles(locale, screenId, paginationParams);
|
42
|
-
}
|
43
|
-
|
44
|
-
@Get(':screenId/route')
|
45
|
-
async listRoutes(
|
46
|
-
@Param('screenId', ParseIntPipe) screenId: number,
|
47
|
-
@Pagination() paginationParams,
|
48
|
-
) {
|
49
|
-
return this.screenService.listRoutes(screenId, paginationParams);
|
50
|
-
}
|
51
|
-
|
52
|
-
@Patch(':screenId/role')
|
53
|
-
async updateRoles(
|
54
|
-
@Param('screenId', ParseIntPipe) screenId: number,
|
55
|
-
@Body() data: UpdateIdsDTO,
|
56
|
-
) {
|
57
|
-
return this.screenService.updateRoles(screenId, data);
|
58
|
-
}
|
59
|
-
|
60
|
-
@Patch(':screenId/route')
|
61
|
-
async updateRoutes(
|
62
|
-
@Param('screenId', ParseIntPipe) screenId: number,
|
63
|
-
@Body() data: UpdateIdsDTO,
|
64
|
-
) {
|
65
|
-
return this.screenService.updateRoutes(screenId, data);
|
66
|
-
}
|
67
|
-
|
68
|
-
@Get(':screenId')
|
69
|
-
async show(@Param('screenId', ParseIntPipe) screenId: number) {
|
70
|
-
return this.screenService.get(screenId);
|
71
|
-
}
|
72
|
-
|
73
|
-
@Post()
|
74
|
-
create(@Body() data: CreateDTO) {
|
75
|
-
return this.screenService.create(data);
|
76
|
-
}
|
77
|
-
|
78
|
-
@Patch(':screenId')
|
79
|
-
async update(
|
80
|
-
@Param('screenId', ParseIntPipe) screenId: number,
|
81
|
-
@Body() data: UpdateDTO,
|
82
|
-
) {
|
83
|
-
return this.screenService.update({
|
84
|
-
id: screenId,
|
85
|
-
data,
|
86
|
-
});
|
87
|
-
}
|
88
|
-
|
89
|
-
@Delete()
|
90
|
-
async delete(@Body() data: DeleteDTO) {
|
91
|
-
return this.screenService.delete(data);
|
92
|
-
}
|
93
|
-
}
|
1
|
+
import { Pagination } from '@hedhog/pagination';
|
2
|
+
import {
|
3
|
+
Body,
|
4
|
+
Controller,
|
5
|
+
Delete,
|
6
|
+
Get,
|
7
|
+
Inject,
|
8
|
+
Param,
|
9
|
+
ParseIntPipe,
|
10
|
+
Patch,
|
11
|
+
Post,
|
12
|
+
forwardRef,
|
13
|
+
} from '@nestjs/common';
|
14
|
+
import { DeleteDTO } from '../dto/delete.dto';
|
15
|
+
import { UpdateIdsDTO } from '../dto/update-ids.dto';
|
16
|
+
import { Locale } from '@hedhog/locale';
|
17
|
+
import { Role } from '@hedhog/core';
|
18
|
+
import { CreateDTO } from './dto/create.dto';
|
19
|
+
import { UpdateDTO } from './dto/update.dto';
|
20
|
+
import { ScreenService } from './screen.service';
|
21
|
+
|
22
|
+
@Role()
|
23
|
+
@Controller('screen')
|
24
|
+
export class ScreenController {
|
25
|
+
constructor(
|
26
|
+
@Inject(forwardRef(() => ScreenService))
|
27
|
+
private readonly screenService: ScreenService,
|
28
|
+
) {}
|
29
|
+
|
30
|
+
@Get()
|
31
|
+
async list(@Pagination() paginationParams, @Locale() locale) {
|
32
|
+
return this.screenService.list(locale, paginationParams);
|
33
|
+
}
|
34
|
+
|
35
|
+
@Get(':screenId/role')
|
36
|
+
async listRoles(
|
37
|
+
@Param('screenId', ParseIntPipe) screenId: number,
|
38
|
+
@Pagination() paginationParams,
|
39
|
+
@Locale() locale,
|
40
|
+
) {
|
41
|
+
return this.screenService.listRoles(locale, screenId, paginationParams);
|
42
|
+
}
|
43
|
+
|
44
|
+
@Get(':screenId/route')
|
45
|
+
async listRoutes(
|
46
|
+
@Param('screenId', ParseIntPipe) screenId: number,
|
47
|
+
@Pagination() paginationParams,
|
48
|
+
) {
|
49
|
+
return this.screenService.listRoutes(screenId, paginationParams);
|
50
|
+
}
|
51
|
+
|
52
|
+
@Patch(':screenId/role')
|
53
|
+
async updateRoles(
|
54
|
+
@Param('screenId', ParseIntPipe) screenId: number,
|
55
|
+
@Body() data: UpdateIdsDTO,
|
56
|
+
) {
|
57
|
+
return this.screenService.updateRoles(screenId, data);
|
58
|
+
}
|
59
|
+
|
60
|
+
@Patch(':screenId/route')
|
61
|
+
async updateRoutes(
|
62
|
+
@Param('screenId', ParseIntPipe) screenId: number,
|
63
|
+
@Body() data: UpdateIdsDTO,
|
64
|
+
) {
|
65
|
+
return this.screenService.updateRoutes(screenId, data);
|
66
|
+
}
|
67
|
+
|
68
|
+
@Get(':screenId')
|
69
|
+
async show(@Param('screenId', ParseIntPipe) screenId: number) {
|
70
|
+
return this.screenService.get(screenId);
|
71
|
+
}
|
72
|
+
|
73
|
+
@Post()
|
74
|
+
create(@Body() data: CreateDTO) {
|
75
|
+
return this.screenService.create(data);
|
76
|
+
}
|
77
|
+
|
78
|
+
@Patch(':screenId')
|
79
|
+
async update(
|
80
|
+
@Param('screenId', ParseIntPipe) screenId: number,
|
81
|
+
@Body() data: UpdateDTO,
|
82
|
+
) {
|
83
|
+
return this.screenService.update({
|
84
|
+
id: screenId,
|
85
|
+
data,
|
86
|
+
});
|
87
|
+
}
|
88
|
+
|
89
|
+
@Delete()
|
90
|
+
async delete(@Body() data: DeleteDTO) {
|
91
|
+
return this.screenService.delete(data);
|
92
|
+
}
|
93
|
+
}
|
@@ -1,18 +1,18 @@
|
|
1
|
-
import { PaginationModule } from '@hedhog/pagination';
|
2
|
-
import { PrismaModule } from '@hedhog/prisma';
|
3
|
-
import { Module, forwardRef } from '@nestjs/common';
|
4
|
-
import { ScreenController } from './screen.controller';
|
5
|
-
import { ScreenService } from './screen.service';
|
6
|
-
import { AuthModule } from '../auth/auth.module';
|
7
|
-
|
8
|
-
@Module({
|
9
|
-
providers: [ScreenService],
|
10
|
-
exports: [ScreenService],
|
11
|
-
controllers: [ScreenController],
|
12
|
-
imports: [
|
13
|
-
forwardRef(() => AuthModule),
|
14
|
-
forwardRef(() => PrismaModule),
|
15
|
-
forwardRef(() => PaginationModule),
|
16
|
-
],
|
17
|
-
})
|
18
|
-
export class ScreenModule {}
|
1
|
+
import { PaginationModule } from '@hedhog/pagination';
|
2
|
+
import { PrismaModule } from '@hedhog/prisma';
|
3
|
+
import { Module, forwardRef } from '@nestjs/common';
|
4
|
+
import { ScreenController } from './screen.controller';
|
5
|
+
import { ScreenService } from './screen.service';
|
6
|
+
import { AuthModule } from '../auth/auth.module';
|
7
|
+
|
8
|
+
@Module({
|
9
|
+
providers: [ScreenService],
|
10
|
+
exports: [ScreenService],
|
11
|
+
controllers: [ScreenController],
|
12
|
+
imports: [
|
13
|
+
forwardRef(() => AuthModule),
|
14
|
+
forwardRef(() => PrismaModule),
|
15
|
+
forwardRef(() => PaginationModule),
|
16
|
+
],
|
17
|
+
})
|
18
|
+
export class ScreenModule {}
|