rez_core 1.1.1 → 1.1.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/dist/module/filter/controller/filter.controller.js.map +1 -1
- package/dist/module/filter/service/saved-filter.service.d.ts +2 -2
- package/dist/module/filter/service/saved-filter.service.js +6 -0
- package/dist/module/filter/service/saved-filter.service.js.map +1 -1
- package/dist/module/meta/controller/entity.controller.js.map +1 -1
- package/dist/module/meta/service/entity-service-impl.service.js +1 -0
- package/dist/module/meta/service/entity-service-impl.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/filter/controller/filter.controller.ts +2 -0
- package/src/module/filter/service/saved-filter.service.ts +8 -2
- package/src/module/meta/controller/entity.controller.ts +30 -12
- package/src/module/meta/service/entity-service-impl.service.ts +2 -0
package/package.json
CHANGED
|
@@ -15,8 +15,11 @@ export class SavedFilterService extends EntityServiceImpl {
|
|
|
15
15
|
|
|
16
16
|
async createEntity(
|
|
17
17
|
entityData: BaseEntity,
|
|
18
|
-
loggedInUser: UserData
|
|
18
|
+
loggedInUser: UserData,
|
|
19
19
|
): Promise<BaseEntity> {
|
|
20
|
+
entityData.organization_id = loggedInUser?.organization_id;
|
|
21
|
+
entityData.enterprise_id = loggedInUser?.enterprise_id;
|
|
22
|
+
(entityData as any).user_id = loggedInUser?.id;
|
|
20
23
|
const master = entityData as SavedFilterMaster;
|
|
21
24
|
|
|
22
25
|
const exists = await this.savedFilterRepo.isFilterNameExists(
|
|
@@ -55,8 +58,11 @@ export class SavedFilterService extends EntityServiceImpl {
|
|
|
55
58
|
|
|
56
59
|
async updateEntity(
|
|
57
60
|
entityData: BaseEntity,
|
|
58
|
-
loggedInUser: UserData
|
|
61
|
+
loggedInUser: UserData,
|
|
59
62
|
): Promise<BaseEntity> {
|
|
63
|
+
entityData.organization_id = loggedInUser?.organization_id;
|
|
64
|
+
entityData.enterprise_id = loggedInUser?.enterprise_id;
|
|
65
|
+
(entityData as any).user_id = loggedInUser?.id;
|
|
60
66
|
const master = entityData as SavedFilterMaster;
|
|
61
67
|
|
|
62
68
|
const existing = await this.getEntityData(
|
|
@@ -2,14 +2,16 @@ import {
|
|
|
2
2
|
BadRequestException,
|
|
3
3
|
Body,
|
|
4
4
|
Controller,
|
|
5
|
-
Get,
|
|
5
|
+
Get,
|
|
6
|
+
HttpCode,
|
|
6
7
|
HttpStatus,
|
|
7
8
|
Param,
|
|
8
9
|
Post,
|
|
9
10
|
Query,
|
|
10
11
|
Res,
|
|
11
12
|
Req,
|
|
12
|
-
UseGuards,
|
|
13
|
+
UseGuards,
|
|
14
|
+
Inject,
|
|
13
15
|
} from '@nestjs/common';
|
|
14
16
|
import { EntityServiceImpl } from '../service/entity-service-impl.service';
|
|
15
17
|
import { ReflectionHelper } from '../../../utils/service/reflection-helper.service';
|
|
@@ -62,10 +64,13 @@ export class EntityController {
|
|
|
62
64
|
@Body() entityData: BaseEntity,
|
|
63
65
|
@Query('entity_type') entityType: string,
|
|
64
66
|
@Res() res: Response,
|
|
65
|
-
@Req() req: Request & {user: any}
|
|
67
|
+
@Req() req: Request & { user: any },
|
|
66
68
|
) {
|
|
67
69
|
let requestedUser = req.user;
|
|
68
|
-
let loggedInUser = await this.entityService.getEntityData(
|
|
70
|
+
let loggedInUser = await this.entityService.getEntityData(
|
|
71
|
+
ENTITYTYPE_USER,
|
|
72
|
+
requestedUser.userId,
|
|
73
|
+
);
|
|
69
74
|
|
|
70
75
|
if (!entityType) {
|
|
71
76
|
throw new BadRequestException(
|
|
@@ -83,7 +88,12 @@ export class EntityController {
|
|
|
83
88
|
if (entityService) {
|
|
84
89
|
return res
|
|
85
90
|
.status(HttpStatus.OK)
|
|
86
|
-
.json(
|
|
91
|
+
.json(
|
|
92
|
+
await entityService.createEntity(
|
|
93
|
+
entityData,
|
|
94
|
+
loggedInUser as UserData,
|
|
95
|
+
),
|
|
96
|
+
);
|
|
87
97
|
}
|
|
88
98
|
}
|
|
89
99
|
|
|
@@ -93,10 +103,13 @@ export class EntityController {
|
|
|
93
103
|
@Body() entityData: BaseEntity,
|
|
94
104
|
@Query('entity_type') entityType: string,
|
|
95
105
|
@Res() response: Response,
|
|
96
|
-
@Req() req: Request & {user: any}
|
|
106
|
+
@Req() req: Request & { user: any },
|
|
97
107
|
) {
|
|
98
108
|
let requestedUser = req.user;
|
|
99
|
-
let loggedInUser = await this.entityService.getEntityData(
|
|
109
|
+
let loggedInUser = await this.entityService.getEntityData(
|
|
110
|
+
ENTITYTYPE_USER,
|
|
111
|
+
requestedUser.userId,
|
|
112
|
+
);
|
|
100
113
|
if (!entityType) {
|
|
101
114
|
throw new BadRequestException(
|
|
102
115
|
'Query parameter "entity_type" is required',
|
|
@@ -117,7 +130,10 @@ export class EntityController {
|
|
|
117
130
|
}
|
|
118
131
|
// let mergeEntity = JsonUtil.merge(existingEntity, entityData);
|
|
119
132
|
|
|
120
|
-
entityData = await entityService.updateEntity(
|
|
133
|
+
entityData = await entityService.updateEntity(
|
|
134
|
+
entityData,
|
|
135
|
+
loggedInUser as UserData,
|
|
136
|
+
);
|
|
121
137
|
return response.status(HttpStatus.OK).json(entityData);
|
|
122
138
|
}
|
|
123
139
|
}
|
|
@@ -147,7 +163,7 @@ export class EntityController {
|
|
|
147
163
|
page,
|
|
148
164
|
size,
|
|
149
165
|
tabColumn,
|
|
150
|
-
tabValue
|
|
166
|
+
tabValue,
|
|
151
167
|
),
|
|
152
168
|
);
|
|
153
169
|
}
|
|
@@ -164,13 +180,12 @@ export class EntityController {
|
|
|
164
180
|
@Res() res: Response, // Express Response for file handling
|
|
165
181
|
) {
|
|
166
182
|
try {
|
|
167
|
-
|
|
168
183
|
const filePath = await this.entityService.generateExcelReport(
|
|
169
184
|
entityType,
|
|
170
185
|
filterCriteria,
|
|
171
186
|
listEntityType,
|
|
172
187
|
displayType,
|
|
173
|
-
sampleExport
|
|
188
|
+
sampleExport,
|
|
174
189
|
);
|
|
175
190
|
|
|
176
191
|
if (!filePath || !fs.existsSync(filePath)) {
|
|
@@ -181,7 +196,10 @@ export class EntityController {
|
|
|
181
196
|
'Content-Disposition',
|
|
182
197
|
`attachment; filename=${path.basename(filePath)}`,
|
|
183
198
|
);
|
|
184
|
-
res.setHeader(
|
|
199
|
+
res.setHeader(
|
|
200
|
+
'Content-Type',
|
|
201
|
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
202
|
+
);
|
|
185
203
|
|
|
186
204
|
const fileStream = fs.createReadStream(filePath);
|
|
187
205
|
fileStream.pipe(res);
|
|
@@ -73,6 +73,8 @@ protected readonly entityValidationService: EntityValidationService;
|
|
|
73
73
|
entityData.code = entityData.entity_type + maxSeqNo;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
entityData.status = "ACTIVE";
|
|
77
|
+
|
|
76
78
|
entityData.created_date = new Date();
|
|
77
79
|
if (loggedInUser) {
|
|
78
80
|
entityData.created_by = loggedInUser.id;
|