verteilen-core 1.3.6 → 1.3.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.
@@ -1,4 +1,4 @@
1
- import { Project, Task } from "../../interface";
1
+ import { Job, Project, Task } from "../../interface";
2
2
  import { MemoryData, RecordLoader } from "../io";
3
3
  import { Server } from "../server";
4
4
  export declare class Project_Module {
@@ -9,6 +9,8 @@ export declare class Project_Module {
9
9
  ProjectJobCount(uuid: string): number;
10
10
  PopulateProject(uuid: string): Project | undefined;
11
11
  PopulateTask(uuid: string): Task | undefined;
12
+ GetProjectRelatedTask(uuid: string): Array<Task>;
13
+ GetTaskRelatedJob(uuid: string): Array<Job>;
12
14
  CascadeDeleteProject(uuid: string, bind: boolean): void;
13
15
  CascadeDeleteTask(uuid: string): void;
14
16
  Delete_Database_Idle(uuid: string): Promise<void>;
@@ -42,6 +42,24 @@ class Project_Module {
42
42
  }
43
43
  return buffer;
44
44
  }
45
+ GetProjectRelatedTask(uuid) {
46
+ const p = this.memory.projects.find(x => x.uuid == uuid);
47
+ if (!p)
48
+ return [];
49
+ const r = p.tasks_uuid.map(x => {
50
+ return this.memory.tasks.find(y => y.uuid == x);
51
+ }).filter(x => x != undefined);
52
+ return r;
53
+ }
54
+ GetTaskRelatedJob(uuid) {
55
+ const p = this.memory.tasks.find(x => x.uuid == uuid);
56
+ if (!p)
57
+ return [];
58
+ const r = p.jobs_uuid.map(x => {
59
+ return this.memory.jobs.find(y => y.uuid == x);
60
+ }).filter(x => x != undefined);
61
+ return r;
62
+ }
45
63
  CascadeDeleteProject(uuid, bind) {
46
64
  const p = this.memory.projects.find(p => p.uuid == uuid);
47
65
  if (!p)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "verteilen-core",
3
- "version": "1.3.6",
3
+ "version": "1.3.7",
4
4
  "license": "MIT",
5
5
  "homepage": "https://verteilen.github.io/wiki/",
6
6
  "author": "Elly",
@@ -55,6 +55,32 @@ export class Project_Module {
55
55
  }
56
56
  return buffer
57
57
  }
58
+ /**
59
+ * Get tasks from project related
60
+ * @param uuid Project UUID
61
+ * @returns Related Tasks
62
+ */
63
+ GetProjectRelatedTask(uuid:string):Array<Task> {
64
+ const p = this.memory.projects.find(x => x.uuid == uuid)
65
+ if(!p) return []
66
+ const r = p.tasks_uuid.map(x => {
67
+ return this.memory.tasks.find(y => y.uuid == x)
68
+ }).filter(x => x != undefined)
69
+ return r
70
+ }
71
+ /**
72
+ * Get jobs from task related
73
+ * @param uuid Task UUID
74
+ * @returns Related Jobs
75
+ */
76
+ GetTaskRelatedJob(uuid:string):Array<Job> {
77
+ const p = this.memory.tasks.find(x => x.uuid == uuid)
78
+ if(!p) return []
79
+ const r = p.jobs_uuid.map(x => {
80
+ return this.memory.jobs.find(y => y.uuid == x)
81
+ }).filter(x => x != undefined)
82
+ return r
83
+ }
58
84
  /**
59
85
  * Delete project related data and project itself
60
86
  * @param uuid Project UUID