task.ts 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. /**
  2. * $table->text('description',512)->nullable();
  3. $table->jsonb('assignees')->index()->nullable();
  4. $table->jsonb('roles')->index()->nullable();
  5. $table->uuid('executor')->index()->nullable();
  6. $table->uuid('executor_relation_task')->index()->nullable();
  7. $table->uuid('parent')->index()->nullable();
  8. $table->jsonb('pre_task')->index()->nullable();
  9. $table->uuid('owner')->index();
  10. $table->uuid('editor')->index();
  11. $table->string('status',32)->index()->default('pending');
  12. $table->timestamps();
  13. */
  14. import { IStudio } from "../auth/Studio";
  15. import { IUser } from "../auth/User";
  16. export type TTaskStatus =
  17. | "pending"
  18. | "published"
  19. | "running"
  20. | "done"
  21. | "restarted"
  22. | "requested_restart"
  23. | "closed"
  24. | "canceled"
  25. | "expired";
  26. export type TTaskType = "instance" | "workflow" | "group";
  27. export interface IProject {
  28. id: string;
  29. title: string;
  30. description: string | null;
  31. }
  32. export interface ITaskData {
  33. id: string;
  34. title: string;
  35. description?: string | null;
  36. html?: string | null;
  37. type: TTaskType;
  38. order?: number;
  39. assignees?: IUser[] | null;
  40. assignees_id?: string[] | null;
  41. parent?: ITaskData | null;
  42. parent_id?: string | null;
  43. roles?: string[] | null;
  44. executor?: IUser | null;
  45. executor_id?: string | null;
  46. executor_relation_task?: ITaskData | null;
  47. executor_relation_task_id?: string | null;
  48. pre_task?: ITaskData[] | null;
  49. pre_task_id?: string | null;
  50. next_task?: ITaskData[] | null;
  51. next_task_id?: string | null;
  52. is_milestone: boolean;
  53. project?: IProject | null;
  54. project_id?: string | null;
  55. owner?: IStudio;
  56. owner_id?: string | null;
  57. editor?: IUser;
  58. editor_id?: string | null;
  59. status?: TTaskStatus;
  60. created_at?: string;
  61. updated_at?: string;
  62. started_at?: string | null;
  63. finished_at?: string | null;
  64. children?: ITaskData[];
  65. }
  66. export interface ITaskUpdateRequest {
  67. id: string;
  68. studio_name: string;
  69. title?: string;
  70. description?: string | null;
  71. type?: TTaskType;
  72. assignees_id?: string[] | null;
  73. parent_id?: string | null;
  74. project_id?: string | null;
  75. roles?: string[] | null;
  76. executor_id?: string | null;
  77. executor_relation_task_id?: string | null;
  78. pre_task_id?: string | null;
  79. next_task_id?: string | null;
  80. is_milestone?: boolean;
  81. status?: string;
  82. }
  83. export interface ITaskListResponse {
  84. ok: boolean;
  85. message: string;
  86. data: {
  87. rows: ITaskData[];
  88. count: number;
  89. };
  90. }
  91. export interface ITaskCreateRequest {
  92. title: string;
  93. studio: string;
  94. type: TTaskType;
  95. }
  96. export interface ITaskResponse {
  97. ok: boolean;
  98. message: string;
  99. data: ITaskData;
  100. }
  101. /**
  102. * $table->uuid('id')->primary()->default(DB::raw('uuid_generate_v1mc()'));
  103. $table->string('title',512)->index();
  104. $table->boolean('is_template')->index()->default(false);
  105. $table->text('description')->nullable();
  106. $table->jsonb('executors')->index()->nullable();
  107. $table->uuid('parent')->index()->nullable();
  108. $table->jsonb('milestone')->index()->nullable();
  109. $table->uuid('owner')->index();
  110. $table->uuid('editor')->index();
  111. $table->jsonb('status')->index();
  112. $table->timestamps();
  113. */
  114. export interface IProjectData {
  115. id: string;
  116. title: string;
  117. type: TProjectType;
  118. description: string | null;
  119. parent?: IProjectData | null;
  120. parent_id?: string | null;
  121. path?: IProjectData[] | null;
  122. executors?: IUser[] | null;
  123. milestone?: IMilestoneInProject[] | null;
  124. owner: IStudio;
  125. editor: IUser;
  126. status: ITaskStatusInProject[];
  127. created_at: string;
  128. updated_at: string;
  129. deleted_at?: string | null;
  130. started_at?: string | null;
  131. finished_at?: string | null;
  132. children?: IProjectData[];
  133. }
  134. export interface IProjectUpdateRequest {
  135. id?: string;
  136. studio_name?: string;
  137. title: string;
  138. type: TProjectType;
  139. description?: string | null;
  140. parent_id?: string | null;
  141. }
  142. export interface IProjectListResponse {
  143. data: { rows: IProjectData[]; count: number };
  144. message: string;
  145. ok: boolean;
  146. }
  147. export interface IProjectResponse {
  148. data: IProjectData;
  149. message: string;
  150. ok: boolean;
  151. }
  152. export type TProjectType = "instance" | "workflow" | "endpoint";
  153. export interface IProjectCreateRequest {
  154. title: string;
  155. type: TProjectType;
  156. studio_name: string;
  157. }
  158. export interface IMilestoneData {
  159. id: string;
  160. title: string;
  161. }
  162. export interface IMilestoneCount {
  163. value: number;
  164. total: number;
  165. }
  166. export interface IMilestoneInProject {
  167. milestone: IMilestoneData;
  168. projects: IMilestoneCount;
  169. chars: IMilestoneCount;
  170. }
  171. export interface ITaskStatusInProject {
  172. status: string;
  173. count: number;
  174. percent: number;
  175. }
  176. export interface ITaskGroupInsertRequest {
  177. data: ITaskGroupInsertData[];
  178. }
  179. export interface ITaskGroupInsertData {
  180. project_id: string;
  181. tasks: ITaskData[];
  182. }
  183. export interface ITaskGroupResponse {
  184. ok: boolean;
  185. message: string;
  186. data: string;
  187. }
  188. export interface IProjectTreeInsertRequest {
  189. studio_name: string;
  190. parent_id?: string | null;
  191. data: IProjectUpdateRequest[];
  192. }
  193. export interface IProjectTreeResponse {
  194. ok: boolean;
  195. message: string;
  196. data: { leafs: string[] };
  197. }