diff --git a/importer/process.go b/importer/process.go new file mode 100644 index 00000000..98e9bd8c --- /dev/null +++ b/importer/process.go @@ -0,0 +1,49 @@ +package importer + +import "github.com/yaoapp/gou" + +func init() { + // 注册处理器 + gou.RegisterProcessHandler("xiang.import.Run", ProcessRun) + gou.RegisterProcessHandler("xiang.import.Data", ProcessData) + gou.RegisterProcessHandler("xiang.import.DataSetting", ProcessDataSetting) + gou.RegisterProcessHandler("xiang.import.Mapping", ProcessMapping) + gou.RegisterProcessHandler("xiang.import.MappingSetting", ProcessMappingSetting) + gou.RegisterProcessHandler("xiang.import.Rules", ProcessRules) +} + +// ProcessRun xiang.import.Run +// 导入数据 +func ProcessRun(process *gou.Process) interface{} { + return nil +} + +// ProcessData xiang.import.Data +// 数据预览 +func ProcessData(process *gou.Process) interface{} { + return nil +} + +// ProcessDataSetting xiang.import.DataSetting +// 数据预览表格配置 +func ProcessDataSetting(process *gou.Process) interface{} { + return nil +} + +// ProcessMapping xiang.import.Mapping +// 字段映射预览 +func ProcessMapping(process *gou.Process) interface{} { + return nil +} + +// ProcessMappingSetting xiang.import.MappingSetting +// 字段映射表格配置 +func ProcessMappingSetting(process *gou.Process) interface{} { + return nil +} + +// ProcessRules xiang.import.Rules +// 可用处理器下拉列表 +func ProcessRules(process *gou.Process) interface{} { + return nil +} diff --git a/importer/process_test.go b/importer/process_test.go new file mode 100644 index 00000000..fca590eb --- /dev/null +++ b/importer/process_test.go @@ -0,0 +1,38 @@ +package importer + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/yaoapp/gou" +) + +func TestProcessMapping(t *testing.T) { + args := []interface{}{"order"} + response := gou.NewProcess("xiang.import.Mapping", args...).Run() + assert.Nil(t, response) +} + +func TestProcessMappingSetting(t *testing.T) { + args := []interface{}{"order"} + response := gou.NewProcess("xiang.import.MappingSetting", args...).Run() + assert.Nil(t, response) +} + +func TestProcessData(t *testing.T) { + args := []interface{}{"order"} + response := gou.NewProcess("xiang.import.Data", args...).Run() + assert.Nil(t, response) +} + +func TestProcessDataSetting(t *testing.T) { + args := []interface{}{"order"} + response := gou.NewProcess("xiang.import.DataSetting", args...).Run() + assert.Nil(t, response) +} + +func TestProcessRules(t *testing.T) { + args := []interface{}{"order"} + response := gou.NewProcess("xiang.import.Rules", args...).Run() + assert.Nil(t, response) +} diff --git a/xiang/apis/import.http.json b/xiang/apis/import.http.json new file mode 100644 index 00000000..4fd99b18 --- /dev/null +++ b/xiang/apis/import.http.json @@ -0,0 +1,69 @@ +{ + "name": "数据导入接口", + "version": "1.0.0", + "description": "数据分析接口API", + "group": "xiang/import", + "guard": "bearer-jwt", + "paths": [ + { + "path": "/:name", + "method": "POST", + "process": "xiang.import.Run", + "in": ["$param.name", ":payload"], + "out": { + "status": 200, + "type": "application/json" + } + }, + { + "path": "/:name/data", + "method": "POST", + "process": "xiang.import.Data", + "in": ["$param.name", ":payload"], + "out": { + "status": 200, + "type": "application/json" + } + }, + { + "path": "/:name/data/setting", + "method": "GET", + "process": "xiang.import.DataSetting", + "in": ["$param.name", ":query"], + "out": { + "status": 200, + "type": "application/json" + } + }, + { + "path": "/:name/mapping", + "method": "GET", + "process": "xiang.import.Mapping", + "in": ["$param.name", ":query"], + "out": { + "status": 200, + "type": "application/json" + } + }, + { + "path": "/:name/mapping/setting", + "method": "GET", + "process": "xiang.import.MappingSetting", + "in": ["$param.name", ":query"], + "out": { + "status": 200, + "type": "application/json" + } + }, + { + "path": "/:name/rule/select", + "method": "GET", + "process": "xiang.import.Rules", + "in": ["$param.name", ":query"], + "out": { + "status": 200, + "type": "application/json" + } + } + ] +}