streamby-core 0.29.6 → 0.29.7
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.
|
@@ -9,11 +9,9 @@ const mongodb_1 = require("mongodb");
|
|
|
9
9
|
function workflowRouter(config) {
|
|
10
10
|
const router = (0, express_1.Router)();
|
|
11
11
|
const Project = (0, manager_1.getModel)('projects');
|
|
12
|
-
// A project has exactly one Workflow (the central canvas)
|
|
13
|
-
//
|
|
14
|
-
|
|
15
|
-
// new single field (and clears the legacy array on Mongo).
|
|
16
|
-
const resolveWorkflow = (project) => project.workflow ?? (project.workflows ?? [])[0] ?? null;
|
|
12
|
+
// A project has exactly one Workflow (the central canvas), stored as the single
|
|
13
|
+
// `project.workflow` object. PATCH upserts it.
|
|
14
|
+
const resolveWorkflow = (project) => project.workflow ?? null;
|
|
17
15
|
router.get('/projects/:id/workflow', async (req, res) => {
|
|
18
16
|
try {
|
|
19
17
|
const auth = await config.authProvider(req);
|
|
@@ -70,7 +68,7 @@ function workflowRouter(config) {
|
|
|
70
68
|
await SqlProject.update({ _id: projectId }, { workflow: updated });
|
|
71
69
|
}
|
|
72
70
|
else {
|
|
73
|
-
await Project.update({ _id: new mongodb_1.ObjectId(projectId) }, { $set: { workflow: updated }
|
|
71
|
+
await Project.update({ _id: new mongodb_1.ObjectId(projectId) }, { $set: { workflow: updated } });
|
|
74
72
|
}
|
|
75
73
|
res.json({ data: updated, message: 'Workflow updated successfully' });
|
|
76
74
|
}
|