Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ type ListReleasePlanOption struct {
SuccessTimeEnd int64
UpdateTimeStart int64
UpdateTimeEnd int64
StartTime int64
EndTime int64
IsSort bool
SortBy SortReleasePlanBy
ExcludedFields []string
Expand Down Expand Up @@ -190,6 +192,12 @@ func (c *ReleasePlanColl) ListByOptions(opt *ListReleasePlanOption) ([]*models.R
if opt.UpdateTimeStart > 0 && opt.UpdateTimeEnd > 0 {
query["update_time"] = bson.M{"$gte": opt.UpdateTimeStart, "$lte": opt.UpdateTimeEnd}
}
if opt.StartTime > 0 && opt.EndTime > 0 {
query["$or"] = []bson.M{
{"start_time": bson.M{"$gte": opt.StartTime, "$lte": opt.EndTime}},
{"end_time": bson.M{"$gte": opt.StartTime, "$lte": opt.EndTime}},
}
}
if opt.Status != "" {
query["status"] = opt.Status
}
Expand Down
18 changes: 14 additions & 4 deletions pkg/microservice/aslan/core/release_plan/service/release_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -1235,10 +1235,12 @@ const (
)

type ListReleasePlanOption struct {
PageNum int64 `form:"pageNum" binding:"required"`
PageSize int64 `form:"pageSize" binding:"required"`
Type ListReleasePlanType `form:"type" binding:"required"`
Keyword string `form:"keyword"`
PageNum int64 `form:"pageNum" binding:"required"`
PageSize int64 `form:"pageSize" binding:"required"`
StartTime int64 `form:"startTime"`
EndTime int64 `form:"endTime"`
Type ListReleasePlanType `form:"type" binding:"required"`
Keyword string `form:"keyword"`
}

type ListReleasePlanResp struct {
Expand All @@ -1259,6 +1261,8 @@ func ListReleasePlans(opt *ListReleasePlanOption) (*ListReleasePlanResp, error)
IsSort: true,
PageNum: opt.PageNum,
PageSize: opt.PageSize,
StartTime: opt.StartTime,
EndTime: opt.EndTime,
ExcludedFields: []string{"jobs", "logs"},
})
case ListReleasePlanTypeManager:
Expand All @@ -1267,6 +1271,8 @@ func ListReleasePlans(opt *ListReleasePlanOption) (*ListReleasePlanResp, error)
IsSort: true,
PageNum: opt.PageNum,
PageSize: opt.PageSize,
StartTime: opt.StartTime,
EndTime: opt.EndTime,
ExcludedFields: []string{"jobs", "logs"},
})
case ListReleasePlanTypeSuccessTime:
Expand All @@ -1293,6 +1299,8 @@ func ListReleasePlans(opt *ListReleasePlanOption) (*ListReleasePlanResp, error)
SortBy: mongodb.SortReleasePlanByUpdateTime,
PageNum: opt.PageNum,
PageSize: opt.PageSize,
StartTime: opt.StartTime,
EndTime: opt.EndTime,
ExcludedFields: []string{"jobs", "logs"},
})
case ListReleasePlanTypeUpdateTime:
Expand All @@ -1319,6 +1327,8 @@ func ListReleasePlans(opt *ListReleasePlanOption) (*ListReleasePlanResp, error)
SortBy: mongodb.SortReleasePlanByUpdateTime,
PageNum: opt.PageNum,
PageSize: opt.PageSize,
StartTime: opt.StartTime,
EndTime: opt.EndTime,
ExcludedFields: []string{"jobs", "logs"},
})
case ListReleasePlanTypeStatus:
Expand Down