@steedos/standard-process-approval 2.5.0-beta.17 → 2.5.0-beta.18
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.
|
@@ -100,6 +100,18 @@ const getProcessNodeObjectName = async function(processId){
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
|
|
104
|
+
const getSourceApprovalProcessNodes = ()=>{
|
|
105
|
+
const nodes = [];
|
|
106
|
+
_.each(objectql.getSourceApprovalProcesses(), (item)=>{
|
|
107
|
+
_.each(item.process_nodes, (pNode)=>{
|
|
108
|
+
nodes.push(Object.assign({}, pNode, {process_definition: item._id, _id: `${item.name}.${pNode.name}`}))
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
})
|
|
112
|
+
return nodes;
|
|
113
|
+
}
|
|
114
|
+
|
|
103
115
|
module.exports = {
|
|
104
116
|
beforeInsert: async function () {
|
|
105
117
|
|
|
@@ -170,62 +182,26 @@ module.exports = {
|
|
|
170
182
|
await reviseRecordOrder(this.previousDoc.process_definition);
|
|
171
183
|
},
|
|
172
184
|
afterFind: async function(){
|
|
173
|
-
let
|
|
174
|
-
let
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
-
delete filters.process_definition
|
|
185
|
+
let spaceId = this.spaceId;
|
|
186
|
+
let sourceData = getSourceApprovalProcessNodes();
|
|
187
|
+
this.data.values = this.data.values.concat(sourceData);
|
|
188
|
+
const values = objectql.getSteedosSchema().metadataDriver.find(this.data.values, this.query, spaceId);
|
|
189
|
+
for(let node of values){
|
|
190
|
+
setSpaceAndOwner(node, this);
|
|
181
191
|
}
|
|
192
|
+
this.data.values = values
|
|
182
193
|
|
|
183
|
-
if(processNodes){
|
|
184
|
-
for(let node of processNodes){
|
|
185
|
-
setSpaceAndOwner(node, this);
|
|
186
|
-
}
|
|
187
|
-
this.data.values = this.data.values.concat(processNodes)
|
|
188
|
-
}
|
|
189
|
-
},
|
|
190
|
-
afterAggregate: async function(){
|
|
191
|
-
let filters = InternalData.parserFilters(this.query.filters)
|
|
192
|
-
let processNodes = [];
|
|
193
|
-
if(filters.process_definition){
|
|
194
|
-
approvalProcess = objectql.getSourceApprovalProcess(filters.process_definition);
|
|
195
|
-
if(approvalProcess){
|
|
196
|
-
processNodes = approvalProcess.process_nodes
|
|
197
|
-
}
|
|
198
|
-
delete filters.process_definition
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
if(processNodes){
|
|
202
|
-
this.data.values = this.data.values.concat(processNodes)
|
|
203
|
-
}
|
|
204
194
|
},
|
|
205
195
|
afterCount: async function(){
|
|
206
|
-
let
|
|
207
|
-
|
|
208
|
-
if(filters.process_definition){
|
|
209
|
-
approvalProcess = objectql.getSourceApprovalProcess(filters.process_definition);
|
|
210
|
-
if(approvalProcess){
|
|
211
|
-
processNodes = approvalProcess.process_nodes
|
|
212
|
-
}
|
|
213
|
-
delete filters.process_definition
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
if(processNodes){
|
|
217
|
-
this.data.values = this.data.values + processNodes.length
|
|
218
|
-
}
|
|
196
|
+
let spaceId = this.spaceId;
|
|
197
|
+
this.data.values = this.data.values + objectql.getSteedosSchema().metadataDriver.count(getSourceApprovalProcessNodes(), this.query, spaceId);
|
|
219
198
|
},
|
|
220
199
|
afterFindOne: async function(){
|
|
200
|
+
let spaceId = this.spaceId;
|
|
221
201
|
if(_.isEmpty(this.data.values)){
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
let processNode = objectql.getSourceProcessNode(objectName, id.substr(id.indexOf(".")+1));
|
|
226
|
-
if(processNode){
|
|
227
|
-
this.data.values = processNode;
|
|
228
|
-
}
|
|
202
|
+
const records = objectql.getSteedosSchema().metadataDriver.find(getSourceApprovalProcessNodes(), {filters: ['_id', '=', this.id]}, spaceId);
|
|
203
|
+
if(records.length > 0){
|
|
204
|
+
this.data.values = records[0]
|
|
229
205
|
}
|
|
230
206
|
}
|
|
231
207
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/standard-process-approval",
|
|
3
|
-
"version": "2.5.0-beta.
|
|
3
|
+
"version": "2.5.0-beta.18",
|
|
4
4
|
"main": "package.service.js",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
"steedos"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@steedos/process": "2.5.0-beta.
|
|
13
|
+
"@steedos/process": "2.5.0-beta.18"
|
|
14
14
|
},
|
|
15
15
|
"description": "steedos package",
|
|
16
16
|
"repository": {},
|
|
17
17
|
"license": "MIT",
|
|
18
|
-
"gitHead": "
|
|
18
|
+
"gitHead": "5567aff68a838502b3e7bb9cab229a3575d1c3ed"
|
|
19
19
|
}
|