Skip to content

Commit 4cc3103

Browse files
authored
Merge pull request #668 from actiontech/dms/feat-967
feat: add project-level ops type for data export workflows
2 parents e14c6a3 + 948c655 commit 4cc3103

29 files changed

Lines changed: 3887 additions & 243 deletions

api/dms/service/v1/data_export_workflow.go

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ type DataExportWorkflow struct {
3232
// Required: false
3333
// example: 1
3434
WorkflowTemplateId uint `json:"workflow_template_id"`
35+
// ops type uid from project dictionary; omit or empty means unset; immutable after create
36+
// Required: false
37+
// example: 7002001
38+
OpsTypeUID string `json:"ops_type_uid"`
3539
}
3640

3741
// swagger:model AddDataExportWorkflowReply
@@ -83,9 +87,12 @@ type ListDataExportWorkflowsReq struct {
8387
// filter by workflow template id
8488
// in:query
8589
FilterWorkflowTemplateId uint `json:"filter_workflow_template_id" query:"filter_workflow_template_id"`
90+
// filter by ops type uid(单选;空则不筛;不提供「未设置」)
91+
// in:query
92+
FilterByOpsTypeUid string `json:"filter_by_ops_type_uid" query:"filter_by_ops_type_uid"`
8693
}
8794

88-
// swagger:parameters FilterGlobalDataExportWorkflowReq
95+
// swagger:parameters GetGlobalDataExportWorkflows
8996
type FilterGlobalDataExportWorkflowReq struct {
9097
// filter status list
9198
// in:query
@@ -145,6 +152,9 @@ type FilterGlobalDataExportWorkflowReq struct {
145152
// filter update time to
146153
// in:query
147154
FilterUpdateTimeTo string `json:"filter_update_time_to" query:"filter_update_time_to"`
155+
// filter by ops type uid(单选;空则不筛;不提供「未设置」;与项目内列表同构)
156+
// in:query
157+
FilterByOpsTypeUid string `json:"filter_by_ops_type_uid" query:"filter_by_ops_type_uid"`
148158
}
149159

150160
// swagger:model GetGlobalDataExportWorkflowsReply
@@ -163,6 +173,8 @@ type GlobalDataExportWorkflow struct {
163173
CreatedAt time.Time `json:"created_at"` // 数据导出工单的创建时间
164174
UpdatedAt time.Time `json:"updated_at"` // 数据导出工单的更新时间
165175
Status DataExportWorkflowStatus `json:"status"` // 数据导出工单的状态
176+
// OpsType 运维类型(按工单所属项目字典批量解析);未设置或字典项已删时省略
177+
OpsType *dmsCommonV1.OpsType `json:"ops_type,omitempty"`
166178

167179
CurrentStepAssigneeUsers []UidWithName `json:"current_step_assignee_user_list"` // 工单待操作人
168180
DBServiceInfos []*dmsCommonV1.DBServiceUidWithNameInfo `json:"db_service_info,omitempty"` // 所属数据源信息
@@ -189,6 +201,8 @@ type ListDataExportWorkflow struct {
189201
Status DataExportWorkflowStatus `json:"status"` // 数据导出工单的状态
190202
WorkflowTemplateId uint `json:"workflow_template_id"` // 创建时关联的审批模板 ID(历史工单可为 0)
191203
WorkflowTemplateName string `json:"workflow_template_name"` // 创建时冗余保存的审批模板名称
204+
// OpsType 运维类型(项目字典批量解析);未设置或字典项已删时省略,供前端「-」约定
205+
OpsType *dmsCommonV1.OpsType `json:"ops_type,omitempty"`
192206

193207
CurrentStepAssigneeUsers []UidWithName `json:"current_step_assignee_user_list"` // 工单待操作人
194208
DBServiceInfos []*dmsCommonV1.DBServiceUidWithNameInfo `json:"db_service_info,omitempty"` // 所属数据源信息
@@ -237,15 +251,17 @@ const (
237251
)
238252

239253
type GetDataExportWorkflow struct {
240-
Name string `json:"workflow_name"`
241-
WorkflowID string `json:"workflow_uid"`
242-
Desc string `json:"desc,omitempty"`
243-
CreateUser UidWithName `json:"create_user"`
244-
CreateTime *time.Time `json:"create_time"`
245-
WorkflowTemplateId uint `json:"workflow_template_id"`
246-
WorkflowTemplateName string `json:"workflow_template_name"`
247-
WorkflowRecord WorkflowRecord `json:"workflow_record"`
248-
WorkflowRecordHistory []WorkflowRecord `json:"workflow_record_history"`
254+
Name string `json:"workflow_name"`
255+
WorkflowID string `json:"workflow_uid"`
256+
Desc string `json:"desc,omitempty"`
257+
CreateUser UidWithName `json:"create_user"`
258+
CreateTime *time.Time `json:"create_time"`
259+
WorkflowTemplateId uint `json:"workflow_template_id"`
260+
WorkflowTemplateName string `json:"workflow_template_name"`
261+
// OpsType 运维类型(项目字典解析);未设置或字典项已删时省略,供前端「-」约定
262+
OpsType *dmsCommonV1.OpsType `json:"ops_type,omitempty"`
263+
WorkflowRecord WorkflowRecord `json:"workflow_record"`
264+
WorkflowRecordHistory []WorkflowRecord `json:"workflow_record_history"`
249265
// UnmaskingWorkflow 关联的查看原文工单摘要;无关联时为 null
250266
UnmaskingWorkflow *DataExportRelatedUnmaskingWorkflow `json:"unmasking_workflow"`
251267
}
@@ -299,7 +315,7 @@ type WorkflowRecord struct {
299315
CurrentStepNumber uint `json:"current_step_number,omitempty"`
300316
Status DataExportWorkflowStatus `json:"status"`
301317
// 导出失败摘要(人类可读);失败类状态时有值,成功/非导出失败为空
302-
ExportFailSummary string `json:"export_fail_summary,omitempty"`
318+
ExportFailSummary string `json:"export_fail_summary,omitempty"`
303319
Steps []*WorkflowStep `json:"workflow_step_list,omitempty"`
304320
}
305321

api/dms/service/v1/ops_type.go

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package v1
2+
3+
import (
4+
base "github.com/actiontech/dms/pkg/dms-common/api/base/v1"
5+
dmsCommonV1 "github.com/actiontech/dms/pkg/dms-common/api/dms/v1"
6+
)
7+
8+
// swagger:model
9+
type CreateOpsTypeReq struct {
10+
// swagger:ignore
11+
ProjectUID string `param:"project_uid" json:"project_uid" validate:"required"`
12+
Name string `json:"ops_type_name" validate:"required,min=1,max=50"`
13+
}
14+
15+
// swagger:model
16+
type UpdateOpsTypeReq struct {
17+
// swagger:ignore
18+
OpsTypeUID string `param:"ops_type_uid" json:"ops_type_uid" validate:"required"`
19+
// swagger:ignore
20+
ProjectUID string `param:"project_uid" json:"project_uid" validate:"required"`
21+
22+
Name string `json:"ops_type_name" validate:"required,min=1,max=50"`
23+
}
24+
25+
// swagger:parameters ListOpsTypes
26+
type ListOpsTypeReq struct {
27+
// in:path
28+
// Required: true
29+
ProjectUID string `param:"project_uid" json:"project_uid" validate:"required"`
30+
// in:query
31+
PageIndex uint32 `query:"page_index" json:"page_index"`
32+
// in:query
33+
// Required: true
34+
PageSize uint32 `query:"page_size" json:"page_size" validate:"required"`
35+
}
36+
37+
// swagger:model ListOpsTypesReply
38+
type ListOpsTypesReply struct {
39+
Data []*dmsCommonV1.OpsType `json:"data"`
40+
Total int64 `json:"total_nums"`
41+
base.GenericResp
42+
}
43+
44+
// swagger:parameters DeleteOpsType
45+
type DeleteOpsTypeReq struct {
46+
// in:path
47+
// Required: true
48+
OpsTypeUID string `param:"ops_type_uid" json:"ops_type_uid" validate:"required"`
49+
// in:path
50+
// Required: true
51+
ProjectUID string `param:"project_uid" json:"project_uid" validate:"required"`
52+
}

0 commit comments

Comments
 (0)