@steedos-labs/plugin-workflow 3.0.4 → 3.0.5
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.
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author: baozhoutao@steedos.com
|
|
3
3
|
* @Date: 2022-09-15 13:09:51
|
|
4
|
-
* @LastEditors:
|
|
5
|
-
* @LastEditTime:
|
|
4
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
5
|
+
* @LastEditTime: 2025-12-17 17:55:57
|
|
6
6
|
* @Description:
|
|
7
7
|
*/
|
|
8
8
|
const express = require("express");
|
|
@@ -17,7 +17,7 @@ router.post('/api/workflow/v2/instance/save', requireAuthentication, async funct
|
|
|
17
17
|
const { instance } = req.body;
|
|
18
18
|
const record = await objectql.getObject('instances').findOne(instance._id, {fields:[
|
|
19
19
|
'flow','form','applicant_name','applicant_organization','applicant_organization_fullname','applicant_organization_name',
|
|
20
|
-
'code', 'flow_version', 'form_version', 'submit_date'
|
|
20
|
+
'code', 'flow_version', 'form_version', 'submit_date', 'flow_name', 'code'
|
|
21
21
|
]});
|
|
22
22
|
const ins = await UUFlowManager.draft_save_instance(Object.assign(record, instance), userSession.userId);
|
|
23
23
|
res.status(200).send({
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: baozhoutao@steedos.com
|
|
3
|
+
* @Date: 2022-09-15 13:09:51
|
|
4
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
5
|
+
* @LastEditTime: 2025-12-17 18:09:28
|
|
6
|
+
* @Description:
|
|
7
|
+
*/
|
|
8
|
+
const express = require("express");
|
|
9
|
+
const router = express.Router();
|
|
10
|
+
const { requireAuthentication } = require("@steedos/auth");
|
|
11
|
+
const _ = require('lodash');
|
|
12
|
+
const objectql = require('@steedos/objectql');
|
|
13
|
+
const UUFlowManager = require('../manager/uuflow_manager');
|
|
14
|
+
router.post('/api/workflow/v2/instance/upgrade', requireAuthentication, async function (req, res) {
|
|
15
|
+
try {
|
|
16
|
+
let userSession = req.user;
|
|
17
|
+
const { instance } = req.body;
|
|
18
|
+
const record = await objectql.getObject('instances').findOne(instance._id, {fields:[
|
|
19
|
+
'flow','form','applicant_name','applicant_organization','applicant_organization_fullname','applicant_organization_name',
|
|
20
|
+
'code', 'flow_version', 'form_version', 'submit_date', 'flow_name', 'code', 'traces', 'state'
|
|
21
|
+
]});
|
|
22
|
+
if(record.state !== 'draft'){
|
|
23
|
+
return res.status(200).send({
|
|
24
|
+
instance: true
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
const ins = await UUFlowManager.draft_save_instance(Object.assign(record, instance), userSession.userId);
|
|
28
|
+
res.status(200).send({
|
|
29
|
+
'instance': ins
|
|
30
|
+
});
|
|
31
|
+
} catch (error) {
|
|
32
|
+
console.error(error);
|
|
33
|
+
res.status(200).send({
|
|
34
|
+
error: error.message
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
exports.default = router;
|