rez_core 2.1.28 → 2.1.30
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/meta/controller/entity.controller.d.ts +7 -4
- package/dist/module/meta/controller/entity.controller.js +33 -80
- package/dist/module/meta/controller/entity.controller.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/meta/controller/entity.controller.ts +56 -96
|
@@ -9,12 +9,15 @@ export declare class EntityController {
|
|
|
9
9
|
private entityMasterService;
|
|
10
10
|
constructor(entityService: EntityServiceImpl, reflectionHelper: ReflectionHelper, entityMasterService: EntityMasterService);
|
|
11
11
|
getById(id: number, entityType?: string): Promise<BaseEntity | null | undefined>;
|
|
12
|
-
create(entityData: BaseEntity, entityType: string,
|
|
12
|
+
create(entityData: BaseEntity, entityType: string, req: Request & {
|
|
13
13
|
user: any;
|
|
14
|
-
}): Promise<
|
|
15
|
-
update(id: number, entityData: BaseEntity, entityType: string,
|
|
14
|
+
}): Promise<any>;
|
|
15
|
+
update(id: number, entityData: BaseEntity, entityType: string, req: Request & {
|
|
16
16
|
user: any;
|
|
17
|
-
}): Promise<
|
|
17
|
+
}): Promise<{
|
|
18
|
+
success: boolean;
|
|
19
|
+
data: any;
|
|
20
|
+
}>;
|
|
18
21
|
getFilterDataWithTabs(entityType: string, listType: string, res: Response, req: any, filters?: Record<string, any>, sortColumn?: string, sortOrder?: string, page?: number, size?: number, tabColumn?: string, tabValue?: string): Promise<Response<any, Record<string, any>>>;
|
|
19
22
|
downloadExcel(entityType: string, listEntityType: string, displayType: string, sampleExport: boolean, filterCriteria: Record<string, any>, res: Response): Promise<Response<any, Record<string, any>> | undefined>;
|
|
20
23
|
}
|
|
@@ -37,85 +37,38 @@ let EntityController = class EntityController {
|
|
|
37
37
|
return await entityService.getEntityData(entityType, id);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
async create(entityData, entityType,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return res.status(common_1.HttpStatus.BAD_REQUEST).json({
|
|
46
|
-
success: false,
|
|
47
|
-
error: 'Query parameter "entity_type" is required',
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
const entityMaster = await this.entityMasterService.getEntityData(entityType);
|
|
51
|
-
const entityService = await this.reflectionHelper.getBean(entityMaster.entity_service);
|
|
52
|
-
if (!entityService) {
|
|
53
|
-
return res.status(common_1.HttpStatus.INTERNAL_SERVER_ERROR).json({
|
|
54
|
-
success: false,
|
|
55
|
-
error: `No service found for Entity Type ${entityType}`,
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
const createdEntity = await entityService.createEntity(entityData, loggedInUser, null, appcode);
|
|
59
|
-
if (!createdEntity) {
|
|
60
|
-
return res.status(common_1.HttpStatus.BAD_REQUEST).json({
|
|
61
|
-
success: false,
|
|
62
|
-
error: createdEntity?.error || 'Entity creation failed',
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
return res.status(common_1.HttpStatus.OK).json({
|
|
66
|
-
success: true,
|
|
67
|
-
data: createdEntity,
|
|
68
|
-
});
|
|
40
|
+
async create(entityData, entityType, req) {
|
|
41
|
+
let loggedInUser = req.user.userData;
|
|
42
|
+
let appcode = req.user.userData.appcode;
|
|
43
|
+
if (!entityType) {
|
|
44
|
+
throw new common_1.BadRequestException(`Query parameter "entity_type" is required`);
|
|
69
45
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
});
|
|
46
|
+
const entityMaster = await this.entityMasterService.getEntityData(entityType);
|
|
47
|
+
const entityService = await this.reflectionHelper.getBean(entityMaster.entity_service);
|
|
48
|
+
if (!entityService) {
|
|
49
|
+
throw new common_1.InternalServerErrorException(`No service found for Entity Type ${entityType}`);
|
|
75
50
|
}
|
|
51
|
+
return entityService.createEntity(entityData, loggedInUser, null, appcode);
|
|
76
52
|
}
|
|
77
|
-
async update(id, entityData, entityType,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return response.status(common_1.HttpStatus.BAD_REQUEST).json({
|
|
82
|
-
success: false,
|
|
83
|
-
error: 'Query parameter "entity_type" is required',
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
const entityMaster = await this.entityMasterService.getEntityData(entityType);
|
|
87
|
-
const entityService = await this.reflectionHelper.getBean(entityMaster.entity_service);
|
|
88
|
-
if (!entityService) {
|
|
89
|
-
return response.status(common_1.HttpStatus.INTERNAL_SERVER_ERROR).json({
|
|
90
|
-
success: false,
|
|
91
|
-
error: `No service found for entity_type "${entityType}"`,
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
let existingEntity = await entityService.getEntityData(entityType, id);
|
|
95
|
-
if (!existingEntity) {
|
|
96
|
-
return response.status(common_1.HttpStatus.NOT_FOUND).json({
|
|
97
|
-
success: false,
|
|
98
|
-
error: `No entity found for id "${id}"`,
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
const updatedEntity = await entityService.updateEntity(entityData, loggedInUser);
|
|
102
|
-
if (!updatedEntity) {
|
|
103
|
-
return response.status(common_1.HttpStatus.BAD_REQUEST).json({
|
|
104
|
-
success: false,
|
|
105
|
-
error: updatedEntity?.error || 'Entity creation failed',
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
return response.status(common_1.HttpStatus.OK).json({
|
|
109
|
-
success: true,
|
|
110
|
-
data: updatedEntity.data,
|
|
111
|
-
});
|
|
53
|
+
async update(id, entityData, entityType, req) {
|
|
54
|
+
const loggedInUser = req.user.userData;
|
|
55
|
+
if (!entityType) {
|
|
56
|
+
throw new common_1.BadRequestException('Query parameter "entity_type" is required');
|
|
112
57
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
58
|
+
const entityMaster = await this.entityMasterService.getEntityData(entityType);
|
|
59
|
+
const entityService = await this.reflectionHelper.getBean(entityMaster.entity_service);
|
|
60
|
+
if (!entityService) {
|
|
61
|
+
throw new common_1.InternalServerErrorException(`No service found for entity_type "${entityType}"`);
|
|
62
|
+
}
|
|
63
|
+
const existingEntity = await entityService.getEntityData(entityType, id);
|
|
64
|
+
if (!existingEntity) {
|
|
65
|
+
throw new common_1.NotFoundException(`No entity found for id "${id}"`);
|
|
118
66
|
}
|
|
67
|
+
const updatedEntity = await entityService.updateEntity(entityData, loggedInUser);
|
|
68
|
+
return {
|
|
69
|
+
success: true,
|
|
70
|
+
data: updatedEntity.data,
|
|
71
|
+
};
|
|
119
72
|
}
|
|
120
73
|
async getFilterDataWithTabs(entityType, listType, res, req, filters = {}, sortColumn, sortOrder, page = 0, size = 1, tabColumn, tabValue) {
|
|
121
74
|
const appcode = req.user.userData.appcode;
|
|
@@ -154,23 +107,23 @@ __decorate([
|
|
|
154
107
|
], EntityController.prototype, "getById", null);
|
|
155
108
|
__decorate([
|
|
156
109
|
(0, common_1.Post)('create'),
|
|
110
|
+
(0, common_1.HttpCode)(200),
|
|
157
111
|
__param(0, (0, common_1.Body)()),
|
|
158
112
|
__param(1, (0, common_1.Query)('entity_type')),
|
|
159
|
-
__param(2, (0, common_1.
|
|
160
|
-
__param(3, (0, common_1.Req)()),
|
|
113
|
+
__param(2, (0, common_1.Req)()),
|
|
161
114
|
__metadata("design:type", Function),
|
|
162
|
-
__metadata("design:paramtypes", [base_entity_entity_1.BaseEntity, String, Object
|
|
115
|
+
__metadata("design:paramtypes", [base_entity_entity_1.BaseEntity, String, Object]),
|
|
163
116
|
__metadata("design:returntype", Promise)
|
|
164
117
|
], EntityController.prototype, "create", null);
|
|
165
118
|
__decorate([
|
|
166
119
|
(0, common_1.Post)('update/:id'),
|
|
120
|
+
(0, common_1.HttpCode)(200),
|
|
167
121
|
__param(0, (0, common_1.Param)('id')),
|
|
168
122
|
__param(1, (0, common_1.Body)()),
|
|
169
123
|
__param(2, (0, common_1.Query)('entity_type')),
|
|
170
|
-
__param(3, (0, common_1.
|
|
171
|
-
__param(4, (0, common_1.Req)()),
|
|
124
|
+
__param(3, (0, common_1.Req)()),
|
|
172
125
|
__metadata("design:type", Function),
|
|
173
|
-
__metadata("design:paramtypes", [Number, base_entity_entity_1.BaseEntity, String, Object
|
|
126
|
+
__metadata("design:paramtypes", [Number, base_entity_entity_1.BaseEntity, String, Object]),
|
|
174
127
|
__metadata("design:returntype", Promise)
|
|
175
128
|
], EntityController.prototype, "update", null);
|
|
176
129
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity.controller.js","sourceRoot":"","sources":["../../../../src/module/meta/controller/entity.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"entity.controller.js","sourceRoot":"","sources":["../../../../src/module/meta/controller/entity.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAiBwB;AACxB,wFAA2E;AAC3E,gGAAoF;AAEpF,4EAAuE;AACvE,qEAA0D;AAC1D,2DAA2D;AAC3D,yBAAyB;AACzB,6BAA6B;AAOtB,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAC3B,YACU,aAAgC,EAChC,gBAAkC,EAClC,mBAAwC;QAFxC,kBAAa,GAAb,aAAa,CAAmB;QAChC,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,wBAAmB,GAAnB,mBAAmB,CAAqB;IAC/C,CAAC;IAIE,AAAN,KAAK,CAAC,OAAO,CACE,EAAU,EACD,UAAmB;QAEzC,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,4BAAmB,CAC3B,2CAA2C,CAC5C,CAAC;QACJ,CAAC;QACD,MAAM,YAAY,GAChB,MAAM,IAAI,CAAC,mBAAmB,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QAE3D,MAAM,aAAa,GACjB,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CACjC,YAAY,CAAC,cAAc,CAC5B,CAAC;QAEJ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