storemw-core-api 1.0.149 → 1.0.151
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/app.js +3 -1
- package/dist/app.js.map +1 -1
- package/dist/controllers/access_control/accessControlRoleController.d.ts +11 -0
- package/dist/controllers/access_control/accessControlRoleController.js +156 -0
- package/dist/controllers/access_control/accessControlRoleController.js.map +1 -0
- package/dist/controllers/access_control/accessControlUserController.d.ts +7 -0
- package/dist/controllers/access_control/accessControlUserController.js +140 -0
- package/dist/controllers/access_control/accessControlUserController.js.map +1 -0
- package/dist/controllers/index.d.ts +3 -0
- package/dist/controllers/index.js +16 -2
- package/dist/controllers/index.js.map +1 -1
- package/dist/controllers/repository/repositoryController.d.ts +12 -0
- package/dist/controllers/repository/repositoryController.js +249 -0
- package/dist/controllers/repository/repositoryController.js.map +1 -0
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +5 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/query_builder/queryScheduler.d.ts +13 -0
- package/dist/lib/query_builder/queryScheduler.js +56 -0
- package/dist/lib/query_builder/queryScheduler.js.map +1 -0
- package/dist/middlewares/route/index.d.ts +2 -0
- package/dist/middlewares/route/index.js +15 -2
- package/dist/middlewares/route/index.js.map +1 -1
- package/dist/middlewares/route/validateAccessControl.d.ts +7 -0
- package/dist/middlewares/route/validateAccessControl.js +28 -0
- package/dist/middlewares/route/validateAccessControl.js.map +1 -0
- package/dist/middlewares/route/validateRepository.d.ts +4 -0
- package/dist/middlewares/route/validateRepository.js +14 -24
- package/dist/middlewares/route/validateRepository.js.map +1 -1
- package/dist/models/access_control/AccessControlRoleModel.d.ts +228 -0
- package/dist/models/access_control/AccessControlRoleModel.js +13 -0
- package/dist/models/access_control/AccessControlRoleModel.js.map +1 -0
- package/dist/models/access_control/AccessControlRolePolicyModel.d.ts +206 -0
- package/dist/models/access_control/AccessControlRolePolicyModel.js +13 -0
- package/dist/models/access_control/AccessControlRolePolicyModel.js.map +1 -0
- package/dist/models/access_control/AccessControlUserRoleModel.d.ts +206 -0
- package/dist/models/access_control/AccessControlUserRoleModel.js +13 -0
- package/dist/models/access_control/AccessControlUserRoleModel.js.map +1 -0
- package/dist/models/index.d.ts +18 -0
- package/dist/models/index.js +30 -2
- package/dist/models/index.js.map +1 -1
- package/dist/models/repository/RepositoryCartonModel.d.ts +312 -0
- package/dist/models/repository/RepositoryCartonModel.js +13 -0
- package/dist/models/repository/RepositoryCartonModel.js.map +1 -0
- package/dist/models/repository/RepositoryContainerModel.d.ts +268 -0
- package/dist/models/repository/RepositoryContainerModel.js +13 -0
- package/dist/models/repository/RepositoryContainerModel.js.map +1 -0
- package/dist/models/repository/RepositoryModel.d.ts +235 -0
- package/dist/models/repository/RepositoryModel.js +13 -0
- package/dist/models/repository/RepositoryModel.js.map +1 -0
- package/dist/models/repository/RepositoryPackageItemModel.d.ts +334 -0
- package/dist/models/repository/RepositoryPackageItemModel.js +13 -0
- package/dist/models/repository/RepositoryPackageItemModel.js.map +1 -0
- package/dist/models/repository/RepositoryPackageModel.d.ts +323 -0
- package/dist/models/repository/RepositoryPackageModel.js +13 -0
- package/dist/models/repository/RepositoryPackageModel.js.map +1 -0
- package/dist/models/repository/RepositoryPalletModel.d.ts +301 -0
- package/dist/models/repository/RepositoryPalletModel.js +13 -0
- package/dist/models/repository/RepositoryPalletModel.js.map +1 -0
- package/dist/routes/access_control/accessControlPoliciesRoutes.d.ts +2 -0
- package/dist/routes/access_control/accessControlPoliciesRoutes.js +11 -0
- package/dist/routes/access_control/accessControlPoliciesRoutes.js.map +1 -0
- package/dist/routes/access_control/accessControlRoleRoutes.d.ts +2 -0
- package/dist/routes/access_control/accessControlRoleRoutes.js +15 -0
- package/dist/routes/access_control/accessControlRoleRoutes.js.map +1 -0
- package/dist/routes/access_control/accessControlRolesRoutes.d.ts +2 -0
- package/dist/routes/access_control/accessControlRolesRoutes.js +13 -0
- package/dist/routes/access_control/accessControlRolesRoutes.js.map +1 -0
- package/dist/routes/access_control/accessControlRoutes.d.ts +0 -1
- package/dist/routes/access_control/accessControlRoutes.js +8 -5
- package/dist/routes/access_control/accessControlRoutes.js.map +1 -1
- package/dist/routes/access_control/accessControlUsersRoutes.d.ts +3 -0
- package/dist/routes/access_control/accessControlUsersRoutes.js +13 -0
- package/dist/routes/access_control/accessControlUsersRoutes.js.map +1 -0
- package/dist/routes/index.d.ts +2 -0
- package/dist/routes/index.js +5 -1
- package/dist/routes/index.js.map +1 -1
- package/dist/routes/repository/repositoriesRoutes.d.ts +2 -0
- package/dist/routes/repository/repositoriesRoutes.js +13 -0
- package/dist/routes/repository/repositoriesRoutes.js.map +1 -0
- package/dist/routes/repository/repositoryRoutes.d.ts +2 -0
- package/dist/routes/repository/repositoryRoutes.js +15 -0
- package/dist/routes/repository/repositoryRoutes.js.map +1 -0
- package/dist/schema/middleware/route/index.d.ts +2 -2
- package/dist/schema/middleware/route/index.js +2 -1
- package/dist/schema/middleware/route/index.js.map +1 -1
- package/dist/schema/middleware/route/schemaAccessControl.d.ts +3 -0
- package/dist/schema/middleware/route/schemaAccessControl.js +6 -1
- package/dist/schema/middleware/route/schemaAccessControl.js.map +1 -1
- package/dist/schema/middleware/route/schemaRepository.d.ts +2 -2
- package/dist/schema/payload/access_control/schemaAccessControlRole.d.ts +219 -0
- package/dist/schema/payload/access_control/schemaAccessControlRole.js +41 -0
- package/dist/schema/payload/access_control/schemaAccessControlRole.js.map +1 -0
- package/dist/schema/payload/access_control/schemaAccessControlUser.d.ts +54 -0
- package/dist/schema/payload/access_control/schemaAccessControlUser.js +34 -0
- package/dist/schema/payload/access_control/schemaAccessControlUser.js.map +1 -0
- package/dist/schema/payload/business/schemaBusiness.d.ts +16 -1
- package/dist/schema/payload/business/schemaBusiness.js +8 -12
- package/dist/schema/payload/business/schemaBusiness.js.map +1 -1
- package/dist/schema/payload/index.d.ts +8 -0
- package/dist/schema/payload/index.js +18 -2
- package/dist/schema/payload/index.js.map +1 -1
- package/dist/schema/payload/injection_field/schemaInjectionField.d.ts +20 -134
- package/dist/schema/payload/injection_field/schemaInjectionField.js +8 -8
- package/dist/schema/payload/injection_field/schemaInjectionField.js.map +1 -1
- package/dist/schema/payload/repository/schemaRepository.d.ts +66 -0
- package/dist/schema/payload/repository/schemaRepository.js +26 -0
- package/dist/schema/payload/repository/schemaRepository.js.map +1 -0
- package/dist/schema/payload/repository/schemaRepositoryContainer.d.ts +292 -0
- package/dist/schema/payload/repository/schemaRepositoryContainer.js +41 -0
- package/dist/schema/payload/repository/schemaRepositoryContainer.js.map +1 -0
- package/dist/services/access_control/AccessControlRoleService.d.ts +49 -0
- package/dist/services/access_control/AccessControlRoleService.js +249 -0
- package/dist/services/access_control/AccessControlRoleService.js.map +1 -0
- package/dist/services/access_control/AccessControlUserService.d.ts +27 -0
- package/dist/services/access_control/AccessControlUserService.js +260 -0
- package/dist/services/access_control/AccessControlUserService.js.map +1 -0
- package/dist/services/index.d.ts +6 -0
- package/dist/services/index.js +8 -5
- package/dist/services/index.js.map +1 -1
- package/dist/services/injection_field/InjectionFieldService.d.ts +4 -2
- package/dist/services/injection_field/RepositoryInjectionFieldService.d.ts +14 -5
- package/dist/services/injection_field/RepositoryInjectionFieldService.js +6 -2
- package/dist/services/injection_field/RepositoryInjectionFieldService.js.map +1 -1
- package/dist/services/repository/RepositoryContainerService.d.ts +64 -0
- package/dist/services/repository/RepositoryContainerService.js +187 -0
- package/dist/services/repository/RepositoryContainerService.js.map +1 -0
- package/dist/services/repository/RepositoryMainService.d.ts +80 -0
- package/dist/services/repository/RepositoryMainService.js +143 -0
- package/dist/services/repository/RepositoryMainService.js.map +1 -0
- package/dist/services/repository/RepositoryService.d.ts +46 -0
- package/dist/services/repository/RepositoryService.js +133 -0
- package/dist/services/repository/RepositoryService.js.map +1 -0
- package/dist/services/scheduler/SchedulerLogService.d.ts +1 -1
- package/dist/services/scheduler/SchedulerLogService.js +32 -34
- package/dist/services/scheduler/SchedulerLogService.js.map +1 -1
- package/dist/utils/accessControlUtils.d.ts +17 -0
- package/dist/utils/accessControlUtils.js +8 -0
- package/dist/utils/accessControlUtils.js.map +1 -0
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +4 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/zodUtils.d.ts +13 -0
- package/dist/utils/zodUtils.js +17 -1
- package/dist/utils/zodUtils.js.map +1 -1
- package/package.json +1 -1
- package/prisma/schema.prisma +188 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deleteRepositories = exports.listRepositories = exports.updateRepository = exports.createRepository = exports.getRepository = void 0;
|
|
4
|
+
const utils_1 = require("../../utils");
|
|
5
|
+
const services_1 = require("../../services");
|
|
6
|
+
const payload_1 = require("../../schema/payload");
|
|
7
|
+
const getRootName = (requestRepositoryType, toSingular) => {
|
|
8
|
+
let rootName = ``;
|
|
9
|
+
switch (requestRepositoryType) {
|
|
10
|
+
case "container":
|
|
11
|
+
rootName = toSingular ? "container" : "containers";
|
|
12
|
+
break;
|
|
13
|
+
case "pallet":
|
|
14
|
+
rootName = toSingular ? "pallet" : "pallets";
|
|
15
|
+
break;
|
|
16
|
+
case "carton":
|
|
17
|
+
rootName = toSingular ? "carton" : "cartons";
|
|
18
|
+
break;
|
|
19
|
+
case "package":
|
|
20
|
+
rootName = toSingular ? "package" : "packages";
|
|
21
|
+
break;
|
|
22
|
+
case "package_item":
|
|
23
|
+
rootName = toSingular ? "package_item" : "package_items";
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
return rootName;
|
|
27
|
+
};
|
|
28
|
+
/** repository/:repositoryType/:repositoryId : get repository */
|
|
29
|
+
const getRepository = async (req, res, next) => {
|
|
30
|
+
try {
|
|
31
|
+
const { repositoryId, repositoryType } = req.params;
|
|
32
|
+
const requestQuery = req.query;
|
|
33
|
+
const requestRepositoryType = repositoryType;
|
|
34
|
+
const repositoryService = (0, services_1.RepositoryService)({
|
|
35
|
+
...(0, utils_1.getDefaultServiceProps)(req),
|
|
36
|
+
repositoryType: requestRepositoryType
|
|
37
|
+
});
|
|
38
|
+
const data = await repositoryService.getRepository({ id: Number(repositoryId), datatypes: requestQuery.datatypes });
|
|
39
|
+
return (0, utils_1.sendSuccess)(res, data, "Retrieved successfully", getRootName(requestRepositoryType, true));
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
next(error);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
exports.getRepository = getRepository;
|
|
46
|
+
/** repository : create repository */
|
|
47
|
+
const createRepository = async (req, res, next) => {
|
|
48
|
+
try {
|
|
49
|
+
let reqScope = req.body.scope;
|
|
50
|
+
let reqPayload = req.body.payload;
|
|
51
|
+
let requestScope = {
|
|
52
|
+
target: reqScope.target,
|
|
53
|
+
action: reqScope.action
|
|
54
|
+
};
|
|
55
|
+
// validate the target
|
|
56
|
+
let request = payload_1.schemaRepositoryScope.parse({
|
|
57
|
+
...requestScope,
|
|
58
|
+
});
|
|
59
|
+
const requestRepositoryType = request.target;
|
|
60
|
+
const repositoryService = (0, services_1.RepositoryService)({
|
|
61
|
+
...(0, utils_1.getDefaultServiceProps)(req),
|
|
62
|
+
repositoryType: requestRepositoryType
|
|
63
|
+
});
|
|
64
|
+
let response = {};
|
|
65
|
+
if (requestRepositoryType === "container") {
|
|
66
|
+
let request = payload_1.schemaRepositoryContainerCreatePayload.parse({
|
|
67
|
+
scope: requestScope,
|
|
68
|
+
payload: {
|
|
69
|
+
repository: {
|
|
70
|
+
repositoryNumber: reqPayload.repository?.repository_number,
|
|
71
|
+
repositoryDate: reqPayload.repository?.repository_date,
|
|
72
|
+
remark: reqPayload.repository?.remark,
|
|
73
|
+
description: reqPayload.repository?.description,
|
|
74
|
+
},
|
|
75
|
+
container: {
|
|
76
|
+
containerNumber: reqPayload.container?.container_number,
|
|
77
|
+
containerDescription: reqPayload.container?.container_description,
|
|
78
|
+
arrivalDate: reqPayload.container?.arrival_date,
|
|
79
|
+
loadDate: reqPayload.container?.load_date,
|
|
80
|
+
sealNumber: reqPayload.container?.seal_number,
|
|
81
|
+
inspectionProviderName: reqPayload.container?.inspection_provider_name,
|
|
82
|
+
shippingProviderName: reqPayload.container?.shipping_provider_name,
|
|
83
|
+
},
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
let payload = {
|
|
87
|
+
repositoryType: requestRepositoryType,
|
|
88
|
+
data: {
|
|
89
|
+
repositoryNumber: request.payload.repository.repositoryNumber ?? "",
|
|
90
|
+
repositoryDate: request.payload.repository.repositoryDate ? utils_1.dayjs.utc(request.payload.repository.repositoryDate).toDate() : null,
|
|
91
|
+
remark: request.payload.repository.repositoryDate,
|
|
92
|
+
description: request.payload.repository.description ?? "",
|
|
93
|
+
container: {
|
|
94
|
+
containerNumber: request.payload.container.containerNumber,
|
|
95
|
+
containerDescription: request.payload.container.containerDescription ?? "",
|
|
96
|
+
arrivalDate: reqPayload.container?.arrival_date,
|
|
97
|
+
loadDate: reqPayload.container?.load_date,
|
|
98
|
+
sealNumber: reqPayload.container?.seal_number,
|
|
99
|
+
inspectionProviderName: reqPayload.container?.inspection_provider_name,
|
|
100
|
+
shippingProviderName: reqPayload.container?.shipping_provider_name,
|
|
101
|
+
},
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
response = {
|
|
105
|
+
[`${getRootName(requestRepositoryType, true)}`]: await repositoryService.createRepository(payload)
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
(0, utils_1.sendSuccess)(res, response, `Repository(${requestRepositoryType}) created successfully`);
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
next(error);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
exports.createRepository = createRepository;
|
|
115
|
+
/** repository/:repositoryId : update repository */
|
|
116
|
+
const updateRepository = async (req, res, next) => {
|
|
117
|
+
try {
|
|
118
|
+
const { repositoryId } = req.params;
|
|
119
|
+
let reqScope = req.body.scope;
|
|
120
|
+
let reqPayload = req.body.payload;
|
|
121
|
+
let requestScope = {
|
|
122
|
+
target: reqScope.target,
|
|
123
|
+
action: reqScope.action
|
|
124
|
+
};
|
|
125
|
+
// validate the target
|
|
126
|
+
let request = payload_1.schemaRepositoryScope.parse({
|
|
127
|
+
...requestScope,
|
|
128
|
+
});
|
|
129
|
+
const requestRepositoryType = request.target;
|
|
130
|
+
const repositoryService = (0, services_1.RepositoryService)({
|
|
131
|
+
...(0, utils_1.getDefaultServiceProps)(req),
|
|
132
|
+
repositoryType: requestRepositoryType
|
|
133
|
+
});
|
|
134
|
+
let response = {};
|
|
135
|
+
if (requestRepositoryType === "container") {
|
|
136
|
+
let request = payload_1.schemaRepositoryContainerUpdatePayload.parse({
|
|
137
|
+
scope: requestScope,
|
|
138
|
+
payload: {
|
|
139
|
+
repository: {
|
|
140
|
+
...(reqPayload.repository?.repository_number ? { repositoryNumber: reqPayload.repository.repository_number } : {}),
|
|
141
|
+
...(reqPayload.repository?.repository_date ? { repositoryDate: reqPayload.repository.repository_date } : {}),
|
|
142
|
+
remark: reqPayload.repository?.remark,
|
|
143
|
+
description: reqPayload.repository?.description,
|
|
144
|
+
},
|
|
145
|
+
container: {
|
|
146
|
+
containerNumber: reqPayload.container?.container_number,
|
|
147
|
+
containerDescription: reqPayload.container?.container_description,
|
|
148
|
+
arrivalDate: reqPayload.container?.arrival_date,
|
|
149
|
+
loadDate: reqPayload.container?.load_date,
|
|
150
|
+
sealNumber: reqPayload.container?.seal_number,
|
|
151
|
+
inspectionProviderName: reqPayload.container?.inspection_provider_name,
|
|
152
|
+
shippingProviderName: reqPayload.container?.shipping_provider_name,
|
|
153
|
+
},
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
let payload = {
|
|
157
|
+
repositoryId: Number(repositoryId),
|
|
158
|
+
repositoryType: requestRepositoryType,
|
|
159
|
+
data: {
|
|
160
|
+
...(request.payload.repository?.repositoryNumber ? { repositoryNumber: request.payload.repository.repositoryNumber } : {}),
|
|
161
|
+
...(request.payload.repository?.repositoryDate ? { repositoryDate: request.payload.repository.repositoryDate } : {}),
|
|
162
|
+
remark: request.payload.repository.remark,
|
|
163
|
+
description: request.payload.repository.description ?? "",
|
|
164
|
+
container: {
|
|
165
|
+
containerNumber: request.payload.container.containerNumber,
|
|
166
|
+
containerDescription: request.payload.container.containerDescription ?? "",
|
|
167
|
+
arrivalDate: reqPayload.container?.arrival_date,
|
|
168
|
+
loadDate: reqPayload.container?.load_date,
|
|
169
|
+
sealNumber: reqPayload.container?.seal_number,
|
|
170
|
+
inspectionProviderName: reqPayload.container?.inspection_provider_name,
|
|
171
|
+
shippingProviderName: reqPayload.container?.shipping_provider_name,
|
|
172
|
+
},
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
response = {
|
|
176
|
+
[`${getRootName(requestRepositoryType, true)}`]: await repositoryService.updateRepository(payload)
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
(0, utils_1.sendSuccess)(res, response, `Repository(${requestRepositoryType}) updated successfully`);
|
|
180
|
+
}
|
|
181
|
+
catch (error) {
|
|
182
|
+
next(error);
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
exports.updateRepository = updateRepository;
|
|
186
|
+
/** repositories : list repositories */
|
|
187
|
+
const listRepositories = async (req, res, next) => {
|
|
188
|
+
try {
|
|
189
|
+
const requestQuery = req.query;
|
|
190
|
+
const requestRepositoryType = req.params.repositoryType;
|
|
191
|
+
const repositoryService = (0, services_1.RepositoryService)({
|
|
192
|
+
...(0, utils_1.getDefaultServiceProps)(req),
|
|
193
|
+
repositoryType: requestRepositoryType
|
|
194
|
+
});
|
|
195
|
+
const { data, total } = await repositoryService.listRepositories({
|
|
196
|
+
...requestQuery,
|
|
197
|
+
});
|
|
198
|
+
let response = {
|
|
199
|
+
[`${getRootName(requestRepositoryType, false)}`]: data,
|
|
200
|
+
total,
|
|
201
|
+
};
|
|
202
|
+
return (0, utils_1.sendSuccess)(res, response, "Retrieved successfully");
|
|
203
|
+
}
|
|
204
|
+
catch (error) {
|
|
205
|
+
next(error);
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
exports.listRepositories = listRepositories;
|
|
209
|
+
/** repositories/delete : delete repositories */
|
|
210
|
+
const deleteRepositories = async (req, res, next) => {
|
|
211
|
+
try {
|
|
212
|
+
const requestRepositoryType = req.body.scope.target;
|
|
213
|
+
// const requestQuery = req.query as unknown as QueryList;
|
|
214
|
+
// const requestFileId = Number(req.params.fileId)
|
|
215
|
+
const request = payload_1.schemaRepositoryDeletePayload.parse(req.body);
|
|
216
|
+
const repositoryService = (0, services_1.RepositoryService)({
|
|
217
|
+
...(0, utils_1.getDefaultServiceProps)(req),
|
|
218
|
+
repositoryType: requestRepositoryType
|
|
219
|
+
});
|
|
220
|
+
const payload = {
|
|
221
|
+
repositoryIds: request.payload.ids.map(i => BigInt(i))
|
|
222
|
+
};
|
|
223
|
+
const data = await repositoryService.removeRepositories(payload);
|
|
224
|
+
return (0, utils_1.sendSuccess)(res, data, "Deleted", getRootName(requestRepositoryType, false));
|
|
225
|
+
}
|
|
226
|
+
catch (error) {
|
|
227
|
+
next(error);
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
exports.deleteRepositories = deleteRepositories;
|
|
231
|
+
/** repository/data_types/:repositoryTyper : get repository data types */
|
|
232
|
+
// export const getRepositoryDataTypes = async (req: Request, res: Response, next: NextFunction): Promise<any> => {
|
|
233
|
+
// try {
|
|
234
|
+
// const requestQuery = req.query as unknown as QueryList;
|
|
235
|
+
// const requestRepositoryType = req.params.userType as RepositoryServiceProps["repositoryType"];
|
|
236
|
+
// const repositoryService = RepositoryService({
|
|
237
|
+
// ...getDefaultServiceProps(req),
|
|
238
|
+
// repositoryType: requestRepositoryType
|
|
239
|
+
// })
|
|
240
|
+
// const data = repositoryService.getDataTypes();
|
|
241
|
+
// let response = {
|
|
242
|
+
// data_types: data
|
|
243
|
+
// }
|
|
244
|
+
// return sendSuccess(res, response, "Retrieved successfully");
|
|
245
|
+
// } catch (error: any) {
|
|
246
|
+
// next(error)
|
|
247
|
+
// }
|
|
248
|
+
// };
|
|
249
|
+
//# sourceMappingURL=repositoryController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repositoryController.js","sourceRoot":"","sources":["../../../src/controllers/repository/repositoryController.ts"],"names":[],"mappings":";;;AAEA,mCAA4F;AAE5F,yCAA2I;AAC3I,8CAK0B;AAG1B,MAAM,WAAW,GAAG,CAAC,qBAA+D,EAAE,UAAmB,EAAE,EAAE;IAEzG,IAAI,QAAQ,GAAQ,EAAE,CAAA;IAEtB,QAAQ,qBAAqB,EAAE,CAAC;QAC5B,KAAK,WAAW;YAAE,QAAQ,GAAG,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,YAAY,CAAC;YAAC,MAAM;QAC5E,KAAK,QAAQ;YAAE,QAAQ,GAAG,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;YAAC,MAAM;QACnE,KAAK,QAAQ;YAAE,QAAQ,GAAG,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;YAAC,MAAM;QACnE,KAAK,SAAS;YAAE,QAAQ,GAAG,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC;YAAC,MAAM;QACtE,KAAK,cAAc;YAAE,QAAQ,GAAG,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,eAAe,CAAC;YAAC,MAAM;IACzF,CAAC;IAED,OAAO,QAAQ,CAAA;AACnB,CAAC,CAAA;AAED,gEAAgE;AACzD,MAAM,aAAa,GAAG,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAgB,EAAE;IACjG,IAAI,CAAC;QAED,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,GAAG,GAA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["import { Request, Response, NextFunction } from \"express\";\n\nimport { getDefaultServiceProps, sendSuccess, sendError, HTTP_STATUS, dayjs } from \"@/utils\"\n\nimport { RepositoryService, RepositoryCreateProps, RepositoryServiceProps, RepositoryUpdateProps, RepositoryRemoveProps } from \"@/services\"\nimport {\n schemaRepositoryScope,\n schemaRepositoryDeletePayload,\n schemaRepositoryContainerCreatePayload,\n schemaRepositoryContainerUpdatePayload,\n} from \"@/schema/payload\";\nimport { QueryList } from \"@/schema/middleware/route\";\n\nconst getRootName = (requestRepositoryType: RepositoryServiceProps[\"repositoryType\"], toSingular: boolean) => {\n\n let rootName: any = ``\n\n switch (requestRepositoryType) {\n case \"container\": rootName = toSingular ? \"container\" : \"containers\"; break;\n case \"pallet\": rootName = toSingular ? \"pallet\" : \"pallets\"; break;\n case \"carton\": rootName = toSingular ? \"carton\" : \"cartons\"; break;\n case \"package\": rootName = toSingular ? \"package\" : \"packages\"; break;\n case \"package_item\": rootName = toSingular ? \"package_item\" : \"package_items\"; break;\n }\n\n return rootName\n}\n\n/** repository/:repositoryType/:repositoryId : get repository */\nexport const getRepository = async (req: Request, res: Response, next: NextFunction): Promise<any> => {\n try {\n\n const { repositoryId, repositoryType } = req.params;\n const requestQuery = req.query as unknown as QueryList;\n const requestRepositoryType = repositoryType as RepositoryServiceProps[\"repositoryType\"];\n\n const repositoryService = RepositoryService({\n ...getDefaultServiceProps(req),\n repositoryType: requestRepositoryType\n })\n\n const data = await repositoryService.getRepository({ id: Number(repositoryId), datatypes: requestQuery.datatypes })\n\n return sendSuccess(res, data, \"Retrieved successfully\", getRootName(requestRepositoryType, true));\n\n } catch (error: any) {\n next(error)\n }\n}\n\n/** repository : create repository */\nexport const createRepository = async (req: Request, res: Response, next: NextFunction): Promise<void> => {\n try {\n\n let reqScope = req.body.scope\n let reqPayload = req.body.payload\n\n let requestScope = {\n target: reqScope.target,\n action: reqScope.action\n }\n\n // validate the target\n let request = schemaRepositoryScope.parse({\n ...requestScope,\n })\n\n const requestRepositoryType = request.target as RepositoryServiceProps[\"repositoryType\"]\n\n const repositoryService = RepositoryService({\n ...getDefaultServiceProps(req),\n repositoryType: requestRepositoryType\n })\n\n let response: any = {}\n\n if (requestRepositoryType === \"container\") {\n\n let request = schemaRepositoryContainerCreatePayload.parse({\n scope: requestScope,\n payload: {\n repository: {\n repositoryNumber: reqPayload.repository?.repository_number,\n repositoryDate: reqPayload.repository?.repository_date,\n remark: reqPayload.repository?.remark,\n description: reqPayload.repository?.description,\n },\n container: {\n containerNumber: reqPayload.container?.container_number,\n containerDescription: reqPayload.container?.container_description,\n arrivalDate: reqPayload.container?.arrival_date,\n loadDate: reqPayload.container?.load_date,\n sealNumber: reqPayload.container?.seal_number,\n inspectionProviderName: reqPayload.container?.inspection_provider_name,\n shippingProviderName: reqPayload.container?.shipping_provider_name,\n },\n }\n })\n\n let payload: RepositoryCreateProps = {\n repositoryType: requestRepositoryType,\n data: {\n repositoryNumber: request.payload.repository.repositoryNumber ?? \"\",\n repositoryDate: request.payload.repository.repositoryDate ? dayjs.utc(request.payload.repository.repositoryDate).toDate() : null,\n remark: request.payload.repository.repositoryDate,\n description: request.payload.repository.description ?? \"\",\n container: {\n containerNumber: request.payload.container.containerNumber,\n containerDescription: request.payload.container.containerDescription ?? \"\",\n arrivalDate: reqPayload.container?.arrival_date,\n loadDate: reqPayload.container?.load_date,\n sealNumber: reqPayload.container?.seal_number,\n inspectionProviderName: reqPayload.container?.inspection_provider_name,\n shippingProviderName: reqPayload.container?.shipping_provider_name,\n },\n }\n }\n\n response = {\n [`${getRootName(requestRepositoryType, true)}`]: await repositoryService.createRepository(payload)\n }\n }\n\n sendSuccess(res, response, `Repository(${requestRepositoryType}) created successfully`)\n\n } catch (error: any) {\n next(error)\n }\n};\n\n/** repository/:repositoryId : update repository */\nexport const updateRepository = async (req: Request, res: Response, next: NextFunction): Promise<void> => {\n try {\n\n const { repositoryId } = req.params;\n\n let reqScope = req.body.scope\n let reqPayload = req.body.payload\n\n let requestScope = {\n target: reqScope.target,\n action: reqScope.action\n }\n\n // validate the target\n let request = schemaRepositoryScope.parse({\n ...requestScope,\n })\n\n const requestRepositoryType = request.target as RepositoryServiceProps[\"repositoryType\"]\n\n const repositoryService = RepositoryService({\n ...getDefaultServiceProps(req),\n repositoryType: requestRepositoryType\n })\n\n let response: any = {}\n\n if (requestRepositoryType === \"container\") {\n\n let request = schemaRepositoryContainerUpdatePayload.parse({\n scope: requestScope,\n payload: {\n repository: {\n ...(reqPayload.repository?.repository_number ? { repositoryNumber: reqPayload.repository.repository_number } : {}),\n ...(reqPayload.repository?.repository_date ? { repositoryDate: reqPayload.repository.repository_date } : {}),\n remark: reqPayload.repository?.remark,\n description: reqPayload.repository?.description,\n },\n container: {\n containerNumber: reqPayload.container?.container_number,\n containerDescription: reqPayload.container?.container_description,\n arrivalDate: reqPayload.container?.arrival_date,\n loadDate: reqPayload.container?.load_date,\n sealNumber: reqPayload.container?.seal_number,\n inspectionProviderName: reqPayload.container?.inspection_provider_name,\n shippingProviderName: reqPayload.container?.shipping_provider_name,\n },\n }\n })\n\n let payload: RepositoryUpdateProps = {\n repositoryId: Number(repositoryId),\n repositoryType: requestRepositoryType,\n data: {\n ...(request.payload.repository?.repositoryNumber ? { repositoryNumber: request.payload.repository.repositoryNumber } : {}),\n ...(request.payload.repository?.repositoryDate ? { repositoryDate: request.payload.repository.repositoryDate } : {}),\n remark: request.payload.repository.remark,\n description: request.payload.repository.description ?? \"\",\n container: {\n containerNumber: request.payload.container.containerNumber,\n containerDescription: request.payload.container.containerDescription ?? \"\",\n arrivalDate: reqPayload.container?.arrival_date,\n loadDate: reqPayload.container?.load_date,\n sealNumber: reqPayload.container?.seal_number,\n inspectionProviderName: reqPayload.container?.inspection_provider_name,\n shippingProviderName: reqPayload.container?.shipping_provider_name,\n },\n }\n }\n\n response = {\n [`${getRootName(requestRepositoryType, true)}`]: await repositoryService.updateRepository(payload)\n }\n }\n\n sendSuccess(res, response, `Repository(${requestRepositoryType}) updated successfully`)\n\n } catch (error: any) {\n next(error)\n }\n};\n\n/** repositories : list repositories */\nexport const listRepositories = async (req: Request, res: Response, next: NextFunction): Promise<any> => {\n\n try {\n\n const requestQuery = req.query as unknown as QueryList;\n const requestRepositoryType = req.params.repositoryType as RepositoryServiceProps[\"repositoryType\"];\n\n const repositoryService = RepositoryService({\n ...getDefaultServiceProps(req),\n repositoryType: requestRepositoryType\n })\n\n const { data, total } = await repositoryService.listRepositories({\n ...requestQuery,\n });\n\n let response = {\n [`${getRootName(requestRepositoryType, false)}`]: data,\n total,\n }\n\n return sendSuccess(res, response, \"Retrieved successfully\");\n\n } catch (error: any) {\n next(error)\n }\n};\n\n/** repositories/delete : delete repositories */\nexport const deleteRepositories = async (req: Request, res: Response, next: NextFunction): Promise<any> => {\n\n try {\n\n const requestRepositoryType = req.body.scope.target as RepositoryServiceProps[\"repositoryType\"]\n // const requestQuery = req.query as unknown as QueryList;\n // const requestFileId = Number(req.params.fileId)\n\n const request = schemaRepositoryDeletePayload.parse(req.body)\n\n const repositoryService = RepositoryService({\n ...getDefaultServiceProps(req),\n repositoryType: requestRepositoryType\n })\n\n const payload: RepositoryRemoveProps = {\n repositoryIds: request.payload.ids.map(i => BigInt(i))\n }\n\n const data = await repositoryService.removeRepositories(payload);\n\n return sendSuccess(res, data, \"Deleted\", getRootName(requestRepositoryType, false));\n\n } catch (error: any) {\n next(error)\n }\n};\n\n/** repository/data_types/:repositoryTyper : get repository data types */\n// export const getRepositoryDataTypes = async (req: Request, res: Response, next: NextFunction): Promise<any> => {\n\n// try {\n\n// const requestQuery = req.query as unknown as QueryList;\n// const requestRepositoryType = req.params.userType as RepositoryServiceProps[\"repositoryType\"];\n\n// const repositoryService = RepositoryService({\n// ...getDefaultServiceProps(req),\n// repositoryType: requestRepositoryType\n// })\n\n// const data = repositoryService.getDataTypes();\n\n// let response = {\n// data_types: data\n// }\n\n// return sendSuccess(res, response, \"Retrieved successfully\");\n\n// } catch (error: any) {\n// next(error)\n// }\n// };\n"]}
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -8,3 +8,4 @@ export type { CustomizeTransformProps } from "./customize/CustomizeTransform";
|
|
|
8
8
|
export { toFieldMap, buildSqlRawSelect, buildSqlRawSelectCount, buildSqlRelation, buildSqlSelect, buildSqlWhere, buildSqlLimitOffset, buildSqlOrderBy, getFieldsByType, buildInjectionFieldsSqlSelect, getListWithCount } from "./query_builder/queryBuilder";
|
|
9
9
|
export { getDocumentSqlRelationMaps, buildDocumentMainSqlSelect, buildDocumentDefaultSqlSelect, buildDocumentProfileSqlSelect, buildDocumentLocationSqlSelect, buildDocumentTotalSqlSelect, buildDocumentItemSqlSelectAgg, buildDocumentItemSqlSelect, buildDocumentDocumentSqlSelectAgg, buildDocumentDocumentSqlSelect } from "./query_builder/queryDocument";
|
|
10
10
|
export { getFileSqlRelationMaps, buildFileMainSqlSelect, buildFileDefaultSqlSelect, } from "./query_builder/queryFile";
|
|
11
|
+
export { getSchedulerLogSqlRelationMaps, buildSchedulerLogMainSqlSelect, buildSchedulerLogDefaultSqlSelect, } from "./query_builder/queryScheduler";
|
package/dist/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildFileDefaultSqlSelect = exports.buildFileMainSqlSelect = exports.getFileSqlRelationMaps = exports.buildDocumentDocumentSqlSelect = exports.buildDocumentDocumentSqlSelectAgg = exports.buildDocumentItemSqlSelect = exports.buildDocumentItemSqlSelectAgg = exports.buildDocumentTotalSqlSelect = exports.buildDocumentLocationSqlSelect = exports.buildDocumentProfileSqlSelect = exports.buildDocumentDefaultSqlSelect = exports.buildDocumentMainSqlSelect = exports.getDocumentSqlRelationMaps = exports.getListWithCount = exports.buildInjectionFieldsSqlSelect = exports.getFieldsByType = exports.buildSqlOrderBy = exports.buildSqlLimitOffset = exports.buildSqlWhere = exports.buildSqlSelect = exports.buildSqlRelation = exports.buildSqlRawSelectCount = exports.buildSqlRawSelect = exports.toFieldMap = exports.CustomizeTransform = exports.serviceFactoryAllowUserTypes = exports.serviceFactoryNames = exports.ServiceFactory = exports.ModelFactory = exports.prisma = void 0;
|
|
3
|
+
exports.buildSchedulerLogDefaultSqlSelect = exports.buildSchedulerLogMainSqlSelect = exports.getSchedulerLogSqlRelationMaps = exports.buildFileDefaultSqlSelect = exports.buildFileMainSqlSelect = exports.getFileSqlRelationMaps = exports.buildDocumentDocumentSqlSelect = exports.buildDocumentDocumentSqlSelectAgg = exports.buildDocumentItemSqlSelect = exports.buildDocumentItemSqlSelectAgg = exports.buildDocumentTotalSqlSelect = exports.buildDocumentLocationSqlSelect = exports.buildDocumentProfileSqlSelect = exports.buildDocumentDefaultSqlSelect = exports.buildDocumentMainSqlSelect = exports.getDocumentSqlRelationMaps = exports.getListWithCount = exports.buildInjectionFieldsSqlSelect = exports.getFieldsByType = exports.buildSqlOrderBy = exports.buildSqlLimitOffset = exports.buildSqlWhere = exports.buildSqlSelect = exports.buildSqlRelation = exports.buildSqlRawSelectCount = exports.buildSqlRawSelect = exports.toFieldMap = exports.CustomizeTransform = exports.serviceFactoryAllowUserTypes = exports.serviceFactoryNames = exports.ServiceFactory = exports.ModelFactory = exports.prisma = void 0;
|
|
4
4
|
var prisma_1 = require("./prisma/prisma");
|
|
5
5
|
Object.defineProperty(exports, "prisma", { enumerable: true, get: function () { return prisma_1.prisma; } });
|
|
6
6
|
var ModelFactory_1 = require("./model_factory/ModelFactory");
|
|
@@ -39,4 +39,8 @@ var queryFile_1 = require("./query_builder/queryFile");
|
|
|
39
39
|
Object.defineProperty(exports, "getFileSqlRelationMaps", { enumerable: true, get: function () { return queryFile_1.getFileSqlRelationMaps; } });
|
|
40
40
|
Object.defineProperty(exports, "buildFileMainSqlSelect", { enumerable: true, get: function () { return queryFile_1.buildFileMainSqlSelect; } });
|
|
41
41
|
Object.defineProperty(exports, "buildFileDefaultSqlSelect", { enumerable: true, get: function () { return queryFile_1.buildFileDefaultSqlSelect; } });
|
|
42
|
+
var queryScheduler_1 = require("./query_builder/queryScheduler");
|
|
43
|
+
Object.defineProperty(exports, "getSchedulerLogSqlRelationMaps", { enumerable: true, get: function () { return queryScheduler_1.getSchedulerLogSqlRelationMaps; } });
|
|
44
|
+
Object.defineProperty(exports, "buildSchedulerLogMainSqlSelect", { enumerable: true, get: function () { return queryScheduler_1.buildSchedulerLogMainSqlSelect; } });
|
|
45
|
+
Object.defineProperty(exports, "buildSchedulerLogDefaultSqlSelect", { enumerable: true, get: function () { return queryScheduler_1.buildSchedulerLogDefaultSqlSelect; } });
|
|
42
46
|
//# sourceMappingURL=index.js.map
|
package/dist/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":";;;AAAA,0CAAwC;AAA/B,gGAAA,MAAM,OAAA;AAEf,6DAA2D;AAAlD,4GAAA,YAAY,OAAA;AAGrB,mEAAoH;AAA3G,gHAAA,cAAc,OAAA;AAAE,qHAAA,mBAAmB,OAAA;AAAE,8HAAA,4BAA4B,OAAA;AAG1E,qEAAmE;AAA1D,wHAAA,kBAAkB,OAAA;AAG3B,6DAA6P;AAApP,0GAAA,UAAU,OAAA;AAAE,iHAAA,iBAAiB,OAAA;AAAE,sHAAA,sBAAsB,OAAA;AAAE,gHAAA,gBAAgB,OAAA;AAAE,8GAAA,cAAc,OAAA;AAAE,6GAAA,aAAa,OAAA;AAAE,mHAAA,mBAAmB,OAAA;AAAE,+GAAA,eAAe,OAAA;AAAE,+GAAA,eAAe,OAAA;AAAE,6HAAA,6BAA6B,OAAA;AAAE,gHAAA,gBAAgB,OAAA;AAEvN,+DAYsC;AAXlC,2HAAA,0BAA0B,OAAA;AAC1B,2HAAA,0BAA0B,OAAA;AAC1B,8HAAA,6BAA6B,OAAA;AAC7B,8HAAA,6BAA6B,OAAA;AAC7B,gCAAgC;AAChC,+HAAA,8BAA8B,OAAA;AAC9B,4HAAA,2BAA2B,OAAA;AAC3B,8HAAA,6BAA6B,OAAA;AAC7B,2HAAA,0BAA0B,OAAA;AAC1B,kIAAA,iCAAiC,OAAA;AACjC,+HAAA,8BAA8B,OAAA;AAGlC,uDAIkC;AAH9B,mHAAA,sBAAsB,OAAA;AACtB,mHAAA,sBAAsB,OAAA;AACtB,sHAAA,yBAAyB,OAAA","sourcesContent":["export { prisma } from \"./prisma/prisma\"\n\nexport { ModelFactory } from \"./model_factory/ModelFactory\"\nexport type { DefaultOmitFields } from \"./model_factory/default\"\n\nexport { ServiceFactory, serviceFactoryNames, serviceFactoryAllowUserTypes } from \"./service_factory/ServiceFactory\"\nexport type { ServiceFactoryName, ServiceFactoryAllowUserType } from \"./service_factory/ServiceFactory\"\n\nexport { CustomizeTransform } from \"./customize/CustomizeTransform\"\nexport type { CustomizeTransformProps } from \"./customize/CustomizeTransform\"\n\nexport { toFieldMap, buildSqlRawSelect, buildSqlRawSelectCount, buildSqlRelation, buildSqlSelect, buildSqlWhere, buildSqlLimitOffset, buildSqlOrderBy, getFieldsByType, buildInjectionFieldsSqlSelect, getListWithCount } from \"./query_builder/queryBuilder\"\n\nexport {\n getDocumentSqlRelationMaps,\n buildDocumentMainSqlSelect,\n buildDocumentDefaultSqlSelect,\n buildDocumentProfileSqlSelect,\n // buildDocumentAmountSqlSelect,\n buildDocumentLocationSqlSelect,\n buildDocumentTotalSqlSelect,\n buildDocumentItemSqlSelectAgg,\n buildDocumentItemSqlSelect,\n buildDocumentDocumentSqlSelectAgg,\n buildDocumentDocumentSqlSelect\n} from \"./query_builder/queryDocument\"\n\nexport {\n getFileSqlRelationMaps,\n buildFileMainSqlSelect,\n buildFileDefaultSqlSelect,\n} from \"./query_builder/queryFile\""]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":";;;AAAA,0CAAwC;AAA/B,gGAAA,MAAM,OAAA;AAEf,6DAA2D;AAAlD,4GAAA,YAAY,OAAA;AAGrB,mEAAoH;AAA3G,gHAAA,cAAc,OAAA;AAAE,qHAAA,mBAAmB,OAAA;AAAE,8HAAA,4BAA4B,OAAA;AAG1E,qEAAmE;AAA1D,wHAAA,kBAAkB,OAAA;AAG3B,6DAA6P;AAApP,0GAAA,UAAU,OAAA;AAAE,iHAAA,iBAAiB,OAAA;AAAE,sHAAA,sBAAsB,OAAA;AAAE,gHAAA,gBAAgB,OAAA;AAAE,8GAAA,cAAc,OAAA;AAAE,6GAAA,aAAa,OAAA;AAAE,mHAAA,mBAAmB,OAAA;AAAE,+GAAA,eAAe,OAAA;AAAE,+GAAA,eAAe,OAAA;AAAE,6HAAA,6BAA6B,OAAA;AAAE,gHAAA,gBAAgB,OAAA;AAEvN,+DAYsC;AAXlC,2HAAA,0BAA0B,OAAA;AAC1B,2HAAA,0BAA0B,OAAA;AAC1B,8HAAA,6BAA6B,OAAA;AAC7B,8HAAA,6BAA6B,OAAA;AAC7B,gCAAgC;AAChC,+HAAA,8BAA8B,OAAA;AAC9B,4HAAA,2BAA2B,OAAA;AAC3B,8HAAA,6BAA6B,OAAA;AAC7B,2HAAA,0BAA0B,OAAA;AAC1B,kIAAA,iCAAiC,OAAA;AACjC,+HAAA,8BAA8B,OAAA;AAGlC,uDAIkC;AAH9B,mHAAA,sBAAsB,OAAA;AACtB,mHAAA,sBAAsB,OAAA;AACtB,sHAAA,yBAAyB,OAAA;AAG7B,iEAIuC;AAHnC,gIAAA,8BAA8B,OAAA;AAC9B,gIAAA,8BAA8B,OAAA;AAC9B,mIAAA,iCAAiC,OAAA","sourcesContent":["export { prisma } from \"./prisma/prisma\"\n\nexport { ModelFactory } from \"./model_factory/ModelFactory\"\nexport type { DefaultOmitFields } from \"./model_factory/default\"\n\nexport { ServiceFactory, serviceFactoryNames, serviceFactoryAllowUserTypes } from \"./service_factory/ServiceFactory\"\nexport type { ServiceFactoryName, ServiceFactoryAllowUserType } from \"./service_factory/ServiceFactory\"\n\nexport { CustomizeTransform } from \"./customize/CustomizeTransform\"\nexport type { CustomizeTransformProps } from \"./customize/CustomizeTransform\"\n\nexport { toFieldMap, buildSqlRawSelect, buildSqlRawSelectCount, buildSqlRelation, buildSqlSelect, buildSqlWhere, buildSqlLimitOffset, buildSqlOrderBy, getFieldsByType, buildInjectionFieldsSqlSelect, getListWithCount } from \"./query_builder/queryBuilder\"\n\nexport {\n getDocumentSqlRelationMaps,\n buildDocumentMainSqlSelect,\n buildDocumentDefaultSqlSelect,\n buildDocumentProfileSqlSelect,\n // buildDocumentAmountSqlSelect,\n buildDocumentLocationSqlSelect,\n buildDocumentTotalSqlSelect,\n buildDocumentItemSqlSelectAgg,\n buildDocumentItemSqlSelect,\n buildDocumentDocumentSqlSelectAgg,\n buildDocumentDocumentSqlSelect\n} from \"./query_builder/queryDocument\"\n\nexport {\n getFileSqlRelationMaps,\n buildFileMainSqlSelect,\n buildFileDefaultSqlSelect,\n} from \"./query_builder/queryFile\"\n\nexport {\n getSchedulerLogSqlRelationMaps,\n buildSchedulerLogMainSqlSelect,\n buildSchedulerLogDefaultSqlSelect,\n} from \"./query_builder/queryScheduler\""]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const getSchedulerLogSqlRelationMaps: () => {
|
|
2
|
+
sqlRelationMaps: Record<"creator" | "updater", string>;
|
|
3
|
+
relationKeys: {
|
|
4
|
+
creator: string;
|
|
5
|
+
updater: string;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
export declare const buildSchedulerLogMainSqlSelect: () => {
|
|
9
|
+
[x: string]: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const buildSchedulerLogDefaultSqlSelect: () => {
|
|
12
|
+
[x: string]: string;
|
|
13
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildSchedulerLogDefaultSqlSelect = exports.buildSchedulerLogMainSqlSelect = exports.getSchedulerLogSqlRelationMaps = void 0;
|
|
4
|
+
const models_1 = require("../../models");
|
|
5
|
+
const queryBuilder_1 = require("./queryBuilder");
|
|
6
|
+
const getSchedulerLogSqlRelationMaps = () => {
|
|
7
|
+
let relationKeys = {
|
|
8
|
+
creator: "creator",
|
|
9
|
+
updater: "updater"
|
|
10
|
+
};
|
|
11
|
+
let sqlRelationMaps = {
|
|
12
|
+
creator: (0, queryBuilder_1.buildSqlRelation)("left", "slog", "users", "creator", ["slog.createuserid = creator.user_id", "creator.isdelete = false", "creator.istrash = false"]),
|
|
13
|
+
updater: (0, queryBuilder_1.buildSqlRelation)("left", "slog", "users", "updater", ["slog.updateuserid = updater.user_id", "updater.isdelete = false", "updater.istrash = false"])
|
|
14
|
+
};
|
|
15
|
+
return {
|
|
16
|
+
sqlRelationMaps,
|
|
17
|
+
relationKeys
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
exports.getSchedulerLogSqlRelationMaps = getSchedulerLogSqlRelationMaps;
|
|
21
|
+
const buildSchedulerLogMainSqlSelect = () => {
|
|
22
|
+
return {
|
|
23
|
+
[`slog.${models_1.ModelSchedulerLogFields.scheduler_log_id}`]: "scheduler_log_id",
|
|
24
|
+
[`slog.${models_1.ModelSchedulerLogFields.scheduler_task_id}`]: "scheduler_task_id",
|
|
25
|
+
[`slog.${models_1.ModelSchedulerLogFields.field_module}`]: "field_module",
|
|
26
|
+
[`slog.${models_1.ModelSchedulerLogFields.field_ref}`]: "field_ref",
|
|
27
|
+
[`slog.${models_1.ModelSchedulerLogFields.flow_type}`]: "flow_type",
|
|
28
|
+
[`slog.${models_1.ModelSchedulerLogFields.destination_type}`]: "destination_type",
|
|
29
|
+
[`slog.${models_1.ModelSchedulerLogFields.destination_entity_id}`]: "destination_entity_id",
|
|
30
|
+
[`slog.${models_1.ModelSchedulerLogFields.destination_entity_label}`]: "destination_entity_label",
|
|
31
|
+
[`slog.${models_1.ModelSchedulerLogFields.destination_submit_payload}`]: "destination_submit_payload",
|
|
32
|
+
[`slog.${models_1.ModelSchedulerLogFields.destination_submit_response}`]: "destination_submit_response",
|
|
33
|
+
[`slog.${models_1.ModelSchedulerLogFields.source_type}`]: "source_type",
|
|
34
|
+
[`slog.${models_1.ModelSchedulerLogFields.source_entity_id}`]: "source_entity_id",
|
|
35
|
+
[`slog.${models_1.ModelSchedulerLogFields.source_entity_label}`]: "source_entity_label",
|
|
36
|
+
[`slog.${models_1.ModelSchedulerLogFields.source_entity_data}`]: "source_entity_data",
|
|
37
|
+
[`slog.${models_1.ModelSchedulerLogFields.log_action}`]: "log_action",
|
|
38
|
+
[`slog.${models_1.ModelSchedulerLogFields.log_label}`]: "log_label",
|
|
39
|
+
[`slog.${models_1.ModelSchedulerLogFields.log_message}`]: "log_message",
|
|
40
|
+
[`slog.${models_1.ModelSchedulerLogFields.log_status}`]: "log_status",
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
exports.buildSchedulerLogMainSqlSelect = buildSchedulerLogMainSqlSelect;
|
|
44
|
+
const buildSchedulerLogDefaultSqlSelect = () => {
|
|
45
|
+
return {
|
|
46
|
+
[`slog.${models_1.ModelSchedulerLogFields.createdatetime}`]: "createdatetime",
|
|
47
|
+
[`creator.${models_1.ModelUserFields.login_username}`]: "createusername",
|
|
48
|
+
[`slog.${models_1.ModelSchedulerLogFields.updatedatetime}`]: "updatedatetime",
|
|
49
|
+
[`updater.${models_1.ModelUserFields.login_username}`]: "updateusername",
|
|
50
|
+
[`slog.${models_1.ModelSchedulerLogFields.isdelete}`]: "isdelete",
|
|
51
|
+
[`slog.${models_1.ModelSchedulerLogFields.istrash}`]: "istrash",
|
|
52
|
+
[`slog.${models_1.ModelSchedulerLogFields.accountid}`]: "accountid",
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
exports.buildSchedulerLogDefaultSqlSelect = buildSchedulerLogDefaultSqlSelect;
|
|
56
|
+
//# sourceMappingURL=queryScheduler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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C,EAAE,WAAW;KAC7D,CAAA;AACL,CAAC,CAAA;AAVY,QAAA,iCAAiC,qCAU7C","sourcesContent":["import {\n ModelUserFields,\n ModelSchedulerLogFields\n} from \"@/models\"\n\nimport { buildSqlRelation } from \"./queryBuilder\";\n\nexport const getSchedulerLogSqlRelationMaps = () => {\n\n let relationKeys = {\n creator: \"creator\",\n updater: \"updater\"\n };\n\n let sqlRelationMaps: Record<keyof typeof relationKeys, ReturnType<typeof buildSqlRelation>> = {\n creator: buildSqlRelation(\"left\", \"slog\", \"users\", \"creator\", [\"slog.createuserid = creator.user_id\", \"creator.isdelete = false\", \"creator.istrash = false\"]),\n updater: buildSqlRelation(\"left\", \"slog\", \"users\", \"updater\", [\"slog.updateuserid = updater.user_id\", \"updater.isdelete = false\", \"updater.istrash = false\"])\n };\n\n return {\n sqlRelationMaps,\n relationKeys\n }\n\n}\n\nexport const buildSchedulerLogMainSqlSelect = () => {\n return {\n [`slog.${ModelSchedulerLogFields.scheduler_log_id}`]: \"scheduler_log_id\",\n [`slog.${ModelSchedulerLogFields.scheduler_task_id}`]: \"scheduler_task_id\",\n [`slog.${ModelSchedulerLogFields.field_module}`]: \"field_module\",\n [`slog.${ModelSchedulerLogFields.field_ref}`]: \"field_ref\",\n [`slog.${ModelSchedulerLogFields.flow_type}`]: \"flow_type\",\n [`slog.${ModelSchedulerLogFields.destination_type}`]: \"destination_type\",\n [`slog.${ModelSchedulerLogFields.destination_entity_id}`]: \"destination_entity_id\",\n [`slog.${ModelSchedulerLogFields.destination_entity_label}`]: \"destination_entity_label\",\n [`slog.${ModelSchedulerLogFields.destination_submit_payload}`]: \"destination_submit_payload\",\n [`slog.${ModelSchedulerLogFields.destination_submit_response}`]: \"destination_submit_response\",\n [`slog.${ModelSchedulerLogFields.source_type}`]: \"source_type\",\n [`slog.${ModelSchedulerLogFields.source_entity_id}`]: \"source_entity_id\",\n [`slog.${ModelSchedulerLogFields.source_entity_label}`]: \"source_entity_label\",\n [`slog.${ModelSchedulerLogFields.source_entity_data}`]: \"source_entity_data\",\n [`slog.${ModelSchedulerLogFields.log_action}`]: \"log_action\",\n [`slog.${ModelSchedulerLogFields.log_label}`]: \"log_label\",\n [`slog.${ModelSchedulerLogFields.log_message}`]: \"log_message\",\n [`slog.${ModelSchedulerLogFields.log_status}`]: \"log_status\",\n }\n}\n\nexport const buildSchedulerLogDefaultSqlSelect = () => {\n return {\n [`slog.${ModelSchedulerLogFields.createdatetime}`]: \"createdatetime\",\n [`creator.${ModelUserFields.login_username}`]: \"createusername\",\n [`slog.${ModelSchedulerLogFields.updatedatetime}`]: \"updatedatetime\",\n [`updater.${ModelUserFields.login_username}`]: \"updateusername\",\n [`slog.${ModelSchedulerLogFields.isdelete}`]: \"isdelete\",\n [`slog.${ModelSchedulerLogFields.istrash}`]: \"istrash\",\n [`slog.${ModelSchedulerLogFields.accountid}`]: \"accountid\",\n }\n}"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { validateRouteUserGet, validateRouteUserList, validateRouteUserCreate, validateRouteUserUpdate, validateRouteUserDelete } from "./validateUser";
|
|
2
2
|
export { validateRouteUserMeGet, validateRouteUserMeUpdate, validateRouteUserMeChangePassword, validateRouteUserMeDelete } from "./validateUserMe";
|
|
3
|
+
export { validateRouteAccessControlRoleGet, validateRouteAccessControlRoleCreate, validateRouteAccessControlRoleUpdate, validateRouteAccessControlRoleList, validateRouteAccessControlRoleDelete, validateRouteAccessControlAssignRoleCreate } from "./validateAccessControl";
|
|
3
4
|
export { validateRouteAccessKeyGet, validateRouteAccessKeyCreate, validateRouteAccessKeyList, validateRouteAccessKeyRevoke } from "./validateAccessKey";
|
|
4
5
|
export { validateRouteOneTimeCodeGet, validateRouteOneTimeCodeList } from "./validateOneTimeCode";
|
|
5
6
|
export { validateRouteResetPasswordRequest, validateRouteResetPasswordValidateCode, validateRouteResetPasswordPerform } from "./validateResetPassword";
|
|
@@ -10,6 +11,7 @@ export { validateRouteBusinessGet, validateRouteBusinessList, validateRouteBusin
|
|
|
10
11
|
export { validateRouteSchedulerLogGet, validateRouteSchedulerLogList, validateRouteSchedulerLogCreate, validateRouteSchedulerLogDelete } from "./validateSchedulerLog";
|
|
11
12
|
export { validateRouteUserBranchGet, validateRouteUserBranchList, validateRouteUserBranchCreate, validateRouteUserBranchUpdate, validateRouteUserBranchDelete } from "./validateUserBranch";
|
|
12
13
|
export { validateRouteDocumentGet, validateRouteDocumentList, validateRouteDocumentCreate, validateRouteDocumentUpdate, validateRouteDocumentDelete } from "./validateDocument";
|
|
14
|
+
export { validateRouteRepositoryGet, validateRouteRepositoryList, validateRouteRepositoryCreate, validateRouteRepositoryUpdate, validateRouteRepositoryDelete } from "./validateRepository";
|
|
13
15
|
export { validateRouteItemGet, validateRouteItemList, validateRouteItemCreate, validateRouteItemUpdate, validateRouteItemDelete } from "./validateItem";
|
|
14
16
|
export { validateRouteFileGet, validateRouteFileList, validateRouteFilesUpload, validateRouteFileDelete } from "./validateFile";
|
|
15
17
|
export { validateRouteLocationGet, validateRouteLocationList, validateRouteLocationCreate, validateRouteLocationUpdate, validateRouteLocationDelete } from "./validateLocation";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.validateRouteAccessKeyUtilAccountOwner = exports.validateRouteAccessKeyUtilValidate = exports.validateRouteChangePasswordUtilValidate = exports.validateRouteAuthTokenGet = exports.validateRouteInjectionFieldDelete = exports.validateRouteInjectionFieldList = exports.validateRouteRegionDelete = exports.validateRouteRegionCreate = exports.validateRouteRegionList = exports.validateRouteRegionGet = exports.validateRouteLocationDelete = exports.validateRouteLocationUpdate = exports.validateRouteLocationCreate = exports.validateRouteLocationList = exports.validateRouteLocationGet = exports.validateRouteFileDelete = exports.validateRouteFilesUpload = exports.validateRouteFileList = exports.validateRouteFileGet = exports.validateRouteItemDelete = exports.validateRouteItemUpdate = exports.validateRouteItemCreate = exports.validateRouteItemList = exports.validateRouteItemGet = exports.validateRouteDocumentDelete = void 0;
|
|
3
|
+
exports.validateRouteUserBranchCreate = exports.validateRouteUserBranchList = exports.validateRouteUserBranchGet = exports.validateRouteSchedulerLogDelete = exports.validateRouteSchedulerLogCreate = exports.validateRouteSchedulerLogList = exports.validateRouteSchedulerLogGet = exports.validateRouteBusinessDelete = exports.validateRouteBusinessUpdate = exports.validateRouteBusinessCreate = exports.validateRouteBusinessList = exports.validateRouteBusinessGet = exports.validateRouteSubscriptionAccountCancel = exports.validateRouteSubscriptionAccountCreate = exports.validateRouteSubscriptionAccountList = exports.validateRouteSubscriptionAccountGet = exports.validateRouteSubscriptionPlanDelete = exports.validateRouteSubscriptionPlanUpdate = exports.validateRouteSubscriptionPlanCreate = exports.validateRouteSubscriptionPlanList = exports.validateRouteSubscriptionPlanGet = exports.validateRouteAccountDelete = exports.validateRouteAccountUpdate = exports.validateRouteAccountCreate = exports.validateRouteAccountList = exports.validateRouteAccountGet = exports.validateRouteResetPasswordPerform = exports.validateRouteResetPasswordValidateCode = exports.validateRouteResetPasswordRequest = exports.validateRouteOneTimeCodeList = exports.validateRouteOneTimeCodeGet = exports.validateRouteAccessKeyRevoke = exports.validateRouteAccessKeyList = exports.validateRouteAccessKeyCreate = exports.validateRouteAccessKeyGet = exports.validateRouteAccessControlAssignRoleCreate = exports.validateRouteAccessControlRoleDelete = exports.validateRouteAccessControlRoleList = exports.validateRouteAccessControlRoleUpdate = exports.validateRouteAccessControlRoleCreate = exports.validateRouteAccessControlRoleGet = exports.validateRouteUserMeDelete = exports.validateRouteUserMeChangePassword = exports.validateRouteUserMeUpdate = exports.validateRouteUserMeGet = exports.validateRouteUserDelete = exports.validateRouteUserUpdate = exports.validateRouteUserCreate = exports.validateRouteUserList = exports.validateRouteUserGet = void 0;
|
|
4
|
+
exports.validateRouteAccessKeyUtilAccountOwner = exports.validateRouteAccessKeyUtilValidate = exports.validateRouteChangePasswordUtilValidate = exports.validateRouteAuthTokenGet = exports.validateRouteInjectionFieldDelete = exports.validateRouteInjectionFieldList = exports.validateRouteRegionDelete = exports.validateRouteRegionCreate = exports.validateRouteRegionList = exports.validateRouteRegionGet = exports.validateRouteLocationDelete = exports.validateRouteLocationUpdate = exports.validateRouteLocationCreate = exports.validateRouteLocationList = exports.validateRouteLocationGet = exports.validateRouteFileDelete = exports.validateRouteFilesUpload = exports.validateRouteFileList = exports.validateRouteFileGet = exports.validateRouteItemDelete = exports.validateRouteItemUpdate = exports.validateRouteItemCreate = exports.validateRouteItemList = exports.validateRouteItemGet = exports.validateRouteRepositoryDelete = exports.validateRouteRepositoryUpdate = exports.validateRouteRepositoryCreate = exports.validateRouteRepositoryList = exports.validateRouteRepositoryGet = exports.validateRouteDocumentDelete = exports.validateRouteDocumentUpdate = exports.validateRouteDocumentCreate = exports.validateRouteDocumentList = exports.validateRouteDocumentGet = exports.validateRouteUserBranchDelete = exports.validateRouteUserBranchUpdate = void 0;
|
|
5
5
|
var validateUser_1 = require("./validateUser");
|
|
6
6
|
Object.defineProperty(exports, "validateRouteUserGet", { enumerable: true, get: function () { return validateUser_1.validateRouteUserGet; } });
|
|
7
7
|
Object.defineProperty(exports, "validateRouteUserList", { enumerable: true, get: function () { return validateUser_1.validateRouteUserList; } });
|
|
@@ -13,6 +13,13 @@ Object.defineProperty(exports, "validateRouteUserMeGet", { enumerable: true, get
|
|
|
13
13
|
Object.defineProperty(exports, "validateRouteUserMeUpdate", { enumerable: true, get: function () { return validateUserMe_1.validateRouteUserMeUpdate; } });
|
|
14
14
|
Object.defineProperty(exports, "validateRouteUserMeChangePassword", { enumerable: true, get: function () { return validateUserMe_1.validateRouteUserMeChangePassword; } });
|
|
15
15
|
Object.defineProperty(exports, "validateRouteUserMeDelete", { enumerable: true, get: function () { return validateUserMe_1.validateRouteUserMeDelete; } });
|
|
16
|
+
var validateAccessControl_1 = require("./validateAccessControl");
|
|
17
|
+
Object.defineProperty(exports, "validateRouteAccessControlRoleGet", { enumerable: true, get: function () { return validateAccessControl_1.validateRouteAccessControlRoleGet; } });
|
|
18
|
+
Object.defineProperty(exports, "validateRouteAccessControlRoleCreate", { enumerable: true, get: function () { return validateAccessControl_1.validateRouteAccessControlRoleCreate; } });
|
|
19
|
+
Object.defineProperty(exports, "validateRouteAccessControlRoleUpdate", { enumerable: true, get: function () { return validateAccessControl_1.validateRouteAccessControlRoleUpdate; } });
|
|
20
|
+
Object.defineProperty(exports, "validateRouteAccessControlRoleList", { enumerable: true, get: function () { return validateAccessControl_1.validateRouteAccessControlRoleList; } });
|
|
21
|
+
Object.defineProperty(exports, "validateRouteAccessControlRoleDelete", { enumerable: true, get: function () { return validateAccessControl_1.validateRouteAccessControlRoleDelete; } });
|
|
22
|
+
Object.defineProperty(exports, "validateRouteAccessControlAssignRoleCreate", { enumerable: true, get: function () { return validateAccessControl_1.validateRouteAccessControlAssignRoleCreate; } });
|
|
16
23
|
var validateAccessKey_1 = require("./validateAccessKey");
|
|
17
24
|
Object.defineProperty(exports, "validateRouteAccessKeyGet", { enumerable: true, get: function () { return validateAccessKey_1.validateRouteAccessKeyGet; } });
|
|
18
25
|
Object.defineProperty(exports, "validateRouteAccessKeyCreate", { enumerable: true, get: function () { return validateAccessKey_1.validateRouteAccessKeyCreate; } });
|
|
@@ -65,6 +72,12 @@ Object.defineProperty(exports, "validateRouteDocumentList", { enumerable: true,
|
|
|
65
72
|
Object.defineProperty(exports, "validateRouteDocumentCreate", { enumerable: true, get: function () { return validateDocument_1.validateRouteDocumentCreate; } });
|
|
66
73
|
Object.defineProperty(exports, "validateRouteDocumentUpdate", { enumerable: true, get: function () { return validateDocument_1.validateRouteDocumentUpdate; } });
|
|
67
74
|
Object.defineProperty(exports, "validateRouteDocumentDelete", { enumerable: true, get: function () { return validateDocument_1.validateRouteDocumentDelete; } });
|
|
75
|
+
var validateRepository_1 = require("./validateRepository");
|
|
76
|
+
Object.defineProperty(exports, "validateRouteRepositoryGet", { enumerable: true, get: function () { return validateRepository_1.validateRouteRepositoryGet; } });
|
|
77
|
+
Object.defineProperty(exports, "validateRouteRepositoryList", { enumerable: true, get: function () { return validateRepository_1.validateRouteRepositoryList; } });
|
|
78
|
+
Object.defineProperty(exports, "validateRouteRepositoryCreate", { enumerable: true, get: function () { return validateRepository_1.validateRouteRepositoryCreate; } });
|
|
79
|
+
Object.defineProperty(exports, "validateRouteRepositoryUpdate", { enumerable: true, get: function () { return validateRepository_1.validateRouteRepositoryUpdate; } });
|
|
80
|
+
Object.defineProperty(exports, "validateRouteRepositoryDelete", { enumerable: true, get: function () { return validateRepository_1.validateRouteRepositoryDelete; } });
|
|
68
81
|
var validateItem_1 = require("./validateItem");
|
|
69
82
|
Object.defineProperty(exports, "validateRouteItemGet", { enumerable: true, get: function () { return validateItem_1.validateRouteItemGet; } });
|
|
70
83
|
Object.defineProperty(exports, "validateRouteItemList", { enumerable: true, get: function () { return validateItem_1.validateRouteItemList; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/middlewares/route/index.ts"],"names":[],"mappings":";;;;AAAA,+CAAuJ;AAA9I,oHAAA,oBAAoB,OAAA;AAAE,qHAAA,qBAAqB,OAAA;AAAE,uHAAA,uBAAuB,OAAA;AAAE,uHAAA,uBAAuB,OAAA;AAAE,uHAAA,uBAAuB,OAAA;AAC/H,mDAAkJ;AAAzI,wHAAA,sBAAsB,OAAA;AAAE,2HAAA,yBAAyB,OAAA;AAAE,mIAAA,iCAAiC,OAAA;AAAE,2HAAA,yBAAyB,OAAA;AACxH,yDAAuJ;AAA9I,8HAAA,yBAAyB,OAAA;AAAE,iIAAA,4BAA4B,OAAA;AAAE,+HAAA,0BAA0B,OAAA;AAAE,iIAAA,4BAA4B,OAAA;AAC1H,6DAAiG;AAAxF,kIAAA,2BAA2B,OAAA;AAAE,mIAAA,4BAA4B,OAAA;AAClE,iEAAsJ;AAA7I,0IAAA,iCAAiC,OAAA;AAAE,+IAAA,sCAAsC,OAAA;AAAE,0IAAA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AAoB,OAAA;AAAE,qHAAA,qBAAqB,OAAA;AAAE,wHAAA,wBAAwB,OAAA;AAAE,uHAAA,uBAAuB,OAAA;AACvG,uDAA+K;AAAtK,4HAAA,wBAAwB,OAAA;AAAE,6HAAA,yBAAyB,OAAA;AAAE,+HAAA,2BAA2B,OAAA;AAAE,+HAAA,2BAA2B,OAAA;AAAE,+HAAA,2BAA2B,OAAA;AACnJ,mDAAwI;AAA/H,wHAAA,sBAAsB,OAAA;AAAE,yHAAA,uBAAuB,OAAA;AAAE,2HAAA,yBAAyB,OAAA;AAAE,2HAAA,yBAAyB,OAAA;AAC9G,mEAA6G;AAApG,yIAAA,+BAA+B,OAAA;AAAE,2IAAA,iCAAiC,OAAA;AAC3E,+CAA0D;AAAjD,yHAAA,yBAAyB,OAAA;AAElC,2EAAsF;AAA7E,qJAAA,uCAAuC,OAAA;AAChD,iEAAoH;AAA3G,2IAAA,kCAAkC,OAAA;AAAE,+IAAA,sCAAsC,OAAA","sourcesContent":["export { validateRouteUserGet, validateRouteUserList, validateRouteUserCreate, validateRouteUserUpdate, validateRouteUserDelete } from \"./validateUser\"\nexport { validateRouteUserMeGet, validateRouteUserMeUpdate, validateRouteUserMeChangePassword, validateRouteUserMeDelete } from \"./validateUserMe\"\nexport { validateRouteAccessKeyGet, validateRouteAccessKeyCreate, validateRouteAccessKeyList, validateRouteAccessKeyRevoke } from \"./validateAccessKey\"\nexport { validateRouteOneTimeCodeGet, validateRouteOneTimeCodeList } from \"./validateOneTimeCode\"\nexport { validateRouteResetPasswordRequest, validateRouteResetPasswordValidateCode, validateRouteResetPasswordPerform } from \"./validateResetPassword\"\nexport { validateRouteAccountGet, validateRouteAccountList, validateRouteAccountCreate, validateRouteAccountUpdate, validateRouteAccountDelete } from \"./validateAccount\"\nexport { validateRouteSubscriptionPlanGet, validateRouteSubscriptionPlanList, validateRouteSubscriptionPlanCreate, validateRouteSubscriptionPlanUpdate, validateRouteSubscriptionPlanDelete } from \"./validateSubscriptionPlan\"\nexport { validateRouteSubscriptionAccountGet, validateRouteSubscriptionAccountList, validateRouteSubscriptionAccountCreate, validateRouteSubscriptionAccountCancel } from \"./validateSubscriptionAccount\"\nexport { validateRouteBusinessGet, validateRouteBusinessList, validateRouteBusinessCreate, validateRouteBusinessUpdate, validateRouteBusinessDelete } from \"./validateBusiness\"\nexport { validateRouteSchedulerLogGet, validateRouteSchedulerLogList, validateRouteSchedulerLogCreate, validateRouteSchedulerLogDelete } from \"./validateSchedulerLog\"\nexport { validateRouteUserBranchGet, validateRouteUserBranchList, validateRouteUserBranchCreate, validateRouteUserBranchUpdate, validateRouteUserBranchDelete } from \"./validateUserBranch\"\nexport { validateRouteDocumentGet, validateRouteDocumentList, validateRouteDocumentCreate, validateRouteDocumentUpdate, validateRouteDocumentDelete } from \"./validateDocument\"\nexport { validateRouteItemGet, validateRouteItemList, validateRouteItemCreate, validateRouteItemUpdate, validateRouteItemDelete } from \"./validateItem\"\nexport { validateRouteFileGet, validateRouteFileList, validateRouteFilesUpload, validateRouteFileDelete } from \"./validateFile\"\nexport { validateRouteLocationGet, validateRouteLocationList, validateRouteLocationCreate, validateRouteLocationUpdate, validateRouteLocationDelete } from \"./validateLocation\"\nexport { validateRouteRegionGet, validateRouteRegionList, validateRouteRegionCreate, validateRouteRegionDelete } from \"./validateRegion\"\nexport { validateRouteInjectionFieldList, validateRouteInjectionFieldDelete } from \"./validateInjectionField\"\nexport { validateRouteAuthTokenGet } from \"./validateAuth\"\n\nexport { validateRouteChangePasswordUtilValidate } from \"./validateChangePasswordUtil\"\nexport { validateRouteAccessKeyUtilValidate, validateRouteAccessKeyUtilAccountOwner } from \"./validateAccessKeyUtil\""]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/middlewares/route/index.ts"],"names":[],"mappings":";;;;AAAA,+CAAuJ;AAA9I,oHAAA,oBAAoB,OAAA;AAAE,qHAAA,qBAAqB,OAAA;AAAE,uHAAA,uBAAuB,OAAA;AAAE,uHAAA,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iC,OAAA;AAC3E,+CAA0D;AAAjD,yHAAA,yBAAyB,OAAA;AAElC,2EAAsF;AAA7E,qJAAA,uCAAuC,OAAA;AAChD,iEAAoH;AAA3G,2IAAA,kCAAkC,OAAA;AAAE,+IAAA,sCAAsC,OAAA","sourcesContent":["export { validateRouteUserGet, validateRouteUserList, validateRouteUserCreate, validateRouteUserUpdate, validateRouteUserDelete } from \"./validateUser\"\nexport { validateRouteUserMeGet, validateRouteUserMeUpdate, validateRouteUserMeChangePassword, validateRouteUserMeDelete } from \"./validateUserMe\"\nexport { validateRouteAccessControlRoleGet, validateRouteAccessControlRoleCreate, validateRouteAccessControlRoleUpdate, validateRouteAccessControlRoleList, validateRouteAccessControlRoleDelete, validateRouteAccessControlAssignRoleCreate } from \"./validateAccessControl\"\nexport { validateRouteAccessKeyGet, validateRouteAccessKeyCreate, validateRouteAccessKeyList, validateRouteAccessKeyRevoke } from \"./validateAccessKey\"\nexport { validateRouteOneTimeCodeGet, validateRouteOneTimeCodeList } from \"./validateOneTimeCode\"\nexport { validateRouteResetPasswordRequest, validateRouteResetPasswordValidateCode, validateRouteResetPasswordPerform } from \"./validateResetPassword\"\nexport { validateRouteAccountGet, validateRouteAccountList, validateRouteAccountCreate, validateRouteAccountUpdate, validateRouteAccountDelete } from \"./validateAccount\"\nexport { validateRouteSubscriptionPlanGet, validateRouteSubscriptionPlanList, validateRouteSubscriptionPlanCreate, validateRouteSubscriptionPlanUpdate, validateRouteSubscriptionPlanDelete } from \"./validateSubscriptionPlan\"\nexport { validateRouteSubscriptionAccountGet, validateRouteSubscriptionAccountList, validateRouteSubscriptionAccountCreate, validateRouteSubscriptionAccountCancel } from \"./validateSubscriptionAccount\"\nexport { validateRouteBusinessGet, validateRouteBusinessList, validateRouteBusinessCreate, validateRouteBusinessUpdate, validateRouteBusinessDelete } from \"./validateBusiness\"\nexport { validateRouteSchedulerLogGet, validateRouteSchedulerLogList, validateRouteSchedulerLogCreate, validateRouteSchedulerLogDelete } from \"./validateSchedulerLog\"\nexport { validateRouteUserBranchGet, validateRouteUserBranchList, validateRouteUserBranchCreate, validateRouteUserBranchUpdate, validateRouteUserBranchDelete } from \"./validateUserBranch\"\nexport { validateRouteDocumentGet, validateRouteDocumentList, validateRouteDocumentCreate, validateRouteDocumentUpdate, validateRouteDocumentDelete } from \"./validateDocument\"\nexport { validateRouteRepositoryGet, validateRouteRepositoryList, validateRouteRepositoryCreate, validateRouteRepositoryUpdate, validateRouteRepositoryDelete } from \"./validateRepository\"\nexport { validateRouteItemGet, validateRouteItemList, validateRouteItemCreate, validateRouteItemUpdate, validateRouteItemDelete } from \"./validateItem\"\nexport { validateRouteFileGet, validateRouteFileList, validateRouteFilesUpload, validateRouteFileDelete } from \"./validateFile\"\nexport { validateRouteLocationGet, validateRouteLocationList, validateRouteLocationCreate, validateRouteLocationUpdate, validateRouteLocationDelete } from \"./validateLocation\"\nexport { validateRouteRegionGet, validateRouteRegionList, validateRouteRegionCreate, validateRouteRegionDelete } from \"./validateRegion\"\nexport { validateRouteInjectionFieldList, validateRouteInjectionFieldDelete } from \"./validateInjectionField\"\nexport { validateRouteAuthTokenGet } from \"./validateAuth\"\n\nexport { validateRouteChangePasswordUtilValidate } from \"./validateChangePasswordUtil\"\nexport { validateRouteAccessKeyUtilValidate, validateRouteAccessKeyUtilAccountOwner } from \"./validateAccessKeyUtil\""]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Request, Response, NextFunction } from "express";
|
|
2
|
+
export declare const validateRouteAccessControlRoleGet: (req: Request, res: Response, next: NextFunction) => void;
|
|
3
|
+
export declare const validateRouteAccessControlRoleList: (req: Request, res: Response, next: NextFunction) => void;
|
|
4
|
+
export declare const validateRouteAccessControlRoleCreate: (req: Request, res: Response, next: NextFunction) => void;
|
|
5
|
+
export declare const validateRouteAccessControlRoleUpdate: (req: Request, res: Response, next: NextFunction) => void;
|
|
6
|
+
export declare const validateRouteAccessControlRoleDelete: (req: Request, res: Response, next: NextFunction) => void;
|
|
7
|
+
export declare const validateRouteAccessControlAssignRoleCreate: (req: Request, res: Response, next: NextFunction) => void;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateRouteAccessControlAssignRoleCreate = exports.validateRouteAccessControlRoleDelete = exports.validateRouteAccessControlRoleUpdate = exports.validateRouteAccessControlRoleCreate = exports.validateRouteAccessControlRoleList = exports.validateRouteAccessControlRoleGet = void 0;
|
|
4
|
+
const utils_1 = require("../../utils");
|
|
5
|
+
const route_1 = require("../../schema/middleware/route");
|
|
6
|
+
const common_1 = require("../../schema/common");
|
|
7
|
+
exports.validateRouteAccessControlRoleGet = (0, utils_1.validateMultipleSchemas)([
|
|
8
|
+
[common_1.schemaQueryGet, "query"]
|
|
9
|
+
]);
|
|
10
|
+
exports.validateRouteAccessControlRoleList = (0, utils_1.validateMultipleSchemas)([
|
|
11
|
+
[route_1.schemaRouteAccessControlRoleList, "params"],
|
|
12
|
+
[common_1.schemaQueryList, "query"]
|
|
13
|
+
]);
|
|
14
|
+
const validateRouteAccessControlRoleCreate = (req, res, next) => {
|
|
15
|
+
next();
|
|
16
|
+
};
|
|
17
|
+
exports.validateRouteAccessControlRoleCreate = validateRouteAccessControlRoleCreate;
|
|
18
|
+
const validateRouteAccessControlRoleUpdate = (req, res, next) => {
|
|
19
|
+
next();
|
|
20
|
+
};
|
|
21
|
+
exports.validateRouteAccessControlRoleUpdate = validateRouteAccessControlRoleUpdate;
|
|
22
|
+
const validateRouteAccessControlRoleDelete = (req, res, next) => next();
|
|
23
|
+
exports.validateRouteAccessControlRoleDelete = validateRouteAccessControlRoleDelete;
|
|
24
|
+
const validateRouteAccessControlAssignRoleCreate = (req, res, next) => {
|
|
25
|
+
next();
|
|
26
|
+
};
|
|
27
|
+
exports.validateRouteAccessControlAssignRoleCreate = validateRouteAccessControlAssignRoleCreate;
|
|
28
|
+
//# sourceMappingURL=validateAccessControl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateAccessControl.js","sourceRoot":"","sources":["../../../src/middlewares/route/validateAccessControl.ts"],"names":[],"mappings":";;;AAOA,mCAA0E;AAC1E,qDAA6E;AAE7E,4CAAkE;AAErD,QAAA,iCAAiC,GAAG,IAAA,+BAAuB,EAAC;IACrE,CAAC,uBAAc,EAAE,OAAO,CAAC;CAC5B,CAAC,CAAA;AAEW,QAAA,kCAAkC,GAAG,IAAA,+BAAuB,EAAC;IACtE,CAAC,wCAAgC,EAAE,QAAQ,CAAC;IAC5C,CAAC,wBAAe,EAAE,OAAO,CAAC;CAC7B,CAAC,CAAA;AAEK,MAAM,oCAAoC,GAAG,CAAC,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAE,EAAE;IACpG,IAAI,EAAE,CAAC;AACX,CAAC,CAAC;AAFW,QAAA,oCAAoC,wCAE/C;AAEK,MAAM,oCAAoC,GAAG,CAAC,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAE,EAAE;IACpG,IAAI,EAAE,CAAC;AACX,CAAC,CAAC;AAFW,QAAA,oCAAoC,wCAE/C;AAEK,MAAM,oCAAoC,GAAG,CAAC,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAE,EAAE,CAAC,IAAI,EAAE,CAAA;AAAlG,QAAA,oCAAoC,wCAA8D;AAExG,MAAM,0CAA0C,GAAG,CAAC,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAE,EAAE;IAC1G,IAAI,EAAE,CAAC;AACX,CAAC,CAAC;AAFW,QAAA,0CAA0C,8CAErD","sourcesContent":["\nimport {\n Request,\n Response,\n NextFunction\n} from \"express\";\n\nimport { validateMultipleSchemas, HTTP_STATUS, sendError } from \"@/utils\";\nimport { schemaRouteAccessControlRoleList } from \"@/schema/middleware/route\";\n\nimport { schemaQueryList, schemaQueryGet } from \"@/schema/common\";\n\nexport const validateRouteAccessControlRoleGet = validateMultipleSchemas([\n [schemaQueryGet, \"query\"]\n])\n\nexport const validateRouteAccessControlRoleList = validateMultipleSchemas([\n [schemaRouteAccessControlRoleList, \"params\"],\n [schemaQueryList, \"query\"]\n])\n\nexport const validateRouteAccessControlRoleCreate = (req: Request, res: Response, next: NextFunction) => {\n next();\n};\n\nexport const validateRouteAccessControlRoleUpdate = (req: Request, res: Response, next: NextFunction) => {\n next();\n};\n\nexport const validateRouteAccessControlRoleDelete = (req: Request, res: Response, next: NextFunction) => next()\n\nexport const validateRouteAccessControlAssignRoleCreate = (req: Request, res: Response, next: NextFunction) => {\n next();\n};"]}
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import { Request, Response, NextFunction } from "express";
|
|
2
|
+
export declare const validateRouteRepositoryGet: (req: Request, res: Response, next: NextFunction) => void;
|
|
2
3
|
export declare const validateRouteRepositoryList: (req: Request, res: Response, next: NextFunction) => void;
|
|
4
|
+
export declare const validateRouteRepositoryCreate: (req: Request, res: Response, next: NextFunction) => void;
|
|
5
|
+
export declare const validateRouteRepositoryUpdate: (req: Request, res: Response, next: NextFunction) => void;
|
|
6
|
+
export declare const validateRouteRepositoryDelete: (req: Request, res: Response, next: NextFunction) => void;
|