powr-sdk-api 4.3.9 → 4.3.10
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/managers/tasks.js +14 -0
- package/package.json +1 -1
package/dist/managers/tasks.js
CHANGED
|
@@ -86,6 +86,20 @@ class TasksManager {
|
|
|
86
86
|
const tasks = await db.collection("tasks").find(query).sort({
|
|
87
87
|
createdAt: -1
|
|
88
88
|
}).toArray();
|
|
89
|
+
|
|
90
|
+
// For workflows, get the last execution time
|
|
91
|
+
for (const task of tasks) {
|
|
92
|
+
if (task.type === 'workflow') {
|
|
93
|
+
const lastExecution = await db.collection("workflow_executions").findOne({
|
|
94
|
+
workflowId: task._id
|
|
95
|
+
}, {
|
|
96
|
+
sort: {
|
|
97
|
+
executedAt: -1
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
task.lastRun = (lastExecution === null || lastExecution === void 0 ? void 0 : lastExecution.executedAt) || null;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
89
103
|
return {
|
|
90
104
|
success: true,
|
|
91
105
|
tasks
|