-
Notifications
You must be signed in to change notification settings - Fork 375
/
autotest_space.go
141 lines (119 loc) · 3.98 KB
/
autotest_space.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
// Copyright (c) 2021 Terminus, Inc.
//
// This program is free software: you can use, redistribute, and/or modify
// it under the terms of the GNU Affero General Public License, version 3
// or later ("AGPL"), as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package apistructs
import "time"
// AutoTestSpaceStatus 测试空间状态
type AutoTestSpaceStatus string
func (a AutoTestSpace) IsOpen() bool {
return a.Status == TestSpaceOpen
}
var (
// TestSpaceCopying 复制中
TestSpaceCopying AutoTestSpaceStatus = "copying"
// TestSpaceLocked 被(复制)锁定
TestSpaceLocked AutoTestSpaceStatus = "locked"
// TestSpaceOpen open
TestSpaceOpen AutoTestSpaceStatus = "open"
// TestSpaceFailed (复制)失败
TestSpaceFailed AutoTestSpaceStatus = "failed"
)
// AutoTestSpace 测试空间
type AutoTestSpace struct {
ID uint64 `json:"id"`
Name string `json:"name"`
ProjectID int64 `json:"projectId"`
Description string `json:"description"`
CreatorID string `json:"creatorId"`
UpdaterID string `json:"updaterId"`
Status AutoTestSpaceStatus `json:"status"`
// 被复制的源测试空间
SourceSpaceID *uint64 `json:"sourceSpaceId,omitempty"`
// CreatedAt 创建时间
CreatedAt time.Time `json:"createdAt"`
// UpdatedAt 更新时间
UpdatedAt time.Time `json:"updatedAt"`
// DeletedAt 删除时间
DeletedAt *time.Time `json:"deletedAt"`
}
// record the structure of the information before and after the scene collection is copied
// to update those scenes that refer to the old scene set to refer to the new scene set
type AutoTestSceneCopyRef struct {
PreSetID uint64 // the id of the copied scene set
PreSpaceID uint64 // the id of the copied space
AfterSetID uint64 // id of the scene set to be copied
AfterSpaceID uint64 // id of the space to be copied
}
// AutoTestSpaceCopy 测试空间复制
type AutoTestSpaceCopy struct {
Name string `json:"name"`
SourceID uint64 `json:"sourceId"`
ProjectID int64 `json:"projectId"`
}
// AutoTestSpaceCreateRequest 测试空间创建请求
type AutoTestSpaceCreateRequest struct {
Name string `json:"name"`
ProjectID int64 `json:"projectId"`
Description string `json:"description"`
SourceSpaceID *uint64 `json:"sourceSpaceId"`
IdentityInfo
}
// AutoTestSpaceCreateResponse 测试空间创建响应
type AutoTestSpaceResponse struct {
Header
Data *AutoTestSpace `json:"data"`
}
// AutoTestSpaceListResponse 获取测试空间列表响应
type AutoTestSpaceListResponse struct {
Header
Data *AutoTestSpaceList `json:"data"`
}
// AutoTestSpaceList 获取测试空间列表
type AutoTestSpaceList struct {
List []AutoTestSpace `json:"list"`
Total int `json:"total"`
}
// AutoTestSpaceExportRequest export autotest space
type AutoTestSpaceExportRequest struct {
ID uint64 `json:"id"`
Locale string `schema:"-"`
IsCopy bool `json:"-"`
FileType TestSpaceFileType `schema:"fileType"`
ProjectID uint64 `json:"projectID"`
SpaceName string `json:"spaceName"`
IdentityInfo
}
type AutoTestSpaceExportResponse struct {
Header
Data uint64 `json:"data"`
}
type TestSpaceFileType string
var (
TestSpaceFileTypeExcel TestSpaceFileType = "excel"
)
func (t TestSpaceFileType) Valid() bool {
switch t {
case TestSpaceFileTypeExcel:
return true
default:
return false
}
}
type AutoTestSpaceImportRequest struct {
ProjectID uint64 `schema:"projectID"`
FileType TestSpaceFileType `schema:"fileType"`
IdentityInfo
}
type AutoTestSpaceImportResponse struct {
Header
Data uint64 `json:"data"`
}