@@ -114,6 +114,14 @@ func SearchPipelineReports(c *gin.Context) {
114114 // Page is the page number for pagination
115115 // This is optional and can be used to paginate the results
116116 Page int `json:"page"`
117+ // StartTime is the start time for the time range filter
118+ // This is optional and can be used to filter reports by a specific start time
119+ // Time format is RFC3339: 2006-01-02T15:04:05Z07:00
120+ StartTime string `json:"start_time"`
121+ // EndTime is the end time for the time range filter
122+ // This is optional and can be used to filter reports by a specific end time
123+ // Time format is RFC3339: 2006-01-02T15:04:05Z07:00
124+ EndTime string `json:"end_time"`
117125 }
118126
119127 queryParams := queryData {}
@@ -130,6 +138,7 @@ func SearchPipelineReports(c *gin.Context) {
130138 c , queryParams .ScmID , queryParams .SourceID , queryParams .ConditionID ,
131139 queryParams .TargetID , database.ReportSearchOptions {Days : monitoringDurationDays },
132140 queryParams .Limit , queryParams .Page ,
141+ queryParams .StartTime , queryParams .EndTime ,
133142 )
134143 if err != nil {
135144 logrus .Errorf ("searching for latest report: %s" , err )
@@ -152,12 +161,18 @@ func SearchPipelineReports(c *gin.Context) {
152161// @Param scmid query string false "SCM ID"
153162// @Param limit query string false "Limit the number of reports returned, default is 100"
154163// @Param page query string false "Page number for pagination, default is 1"
164+ // @Param start_time query string false "Start time for filtering reports (RFC3339 format)"
165+ // @Param end_time query string false "End time for filtering reports (RFC3339 format)"
166+ // @Accept json
167+ // @Produce json
155168// @Success 200 {object} GetPipelineReportsResponse
156169// @Failure 500 {object} DefaultResponseModel
157170// @Router /api/pipeline/reports [get]
158171func ListPipelineReports (c * gin.Context ) {
159172 queryParams := c .Request .URL .Query ()
160173 scmID := queryParams .Get ("scmid" )
174+ startTime := queryParams .Get ("start_time" )
175+ endTime := queryParams .Get ("end_time" )
161176
162177 limit , page , err := getPaginationParamFromURLQuery (c )
163178 if err != nil {
@@ -173,6 +188,7 @@ func ListPipelineReports(c *gin.Context) {
173188 database.ReportSearchOptions {Days : monitoringDurationDays },
174189 limit ,
175190 page ,
191+ startTime , endTime ,
176192 )
177193
178194 if err != nil {
0 commit comments