mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-26 17:49:15 +01:00
refactor: standardize response types across controllers
- Updated multiple controller methods to return VoidResponse instead of generic Response[any]. - Consolidated error handling to utilize GetErrorVoidResponse for consistent error responses. - Enhanced parameter handling in export and file management functions for improved clarity and maintainability. - Refactored health check and login/logout methods to align with new response structure. - Improved overall consistency in response formatting across various endpoints.
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"github.com/crawlab-team/crawlab/core/interfaces"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Export struct {
|
||||
Id string `json:"id"`
|
||||
Type string `json:"type"`
|
||||
Target string `json:"target"`
|
||||
Filter interfaces.Filter `json:"filter"`
|
||||
Status string `json:"status"`
|
||||
StartTs time.Time `json:"start_ts"`
|
||||
EndTs time.Time `json:"end_ts"`
|
||||
FileName string `json:"file_name"`
|
||||
DownloadPath string `json:"-"`
|
||||
Limit int `json:"-"`
|
||||
Id string `json:"id"`
|
||||
Type string `json:"type"`
|
||||
Target string `json:"target"`
|
||||
Query bson.M `json:"query"`
|
||||
Status string `json:"status"`
|
||||
StartTs time.Time `json:"start_ts"`
|
||||
EndTs time.Time `json:"end_ts"`
|
||||
FileName string `json:"file_name"`
|
||||
DownloadPath string `json:"-"`
|
||||
Limit int `json:"-"`
|
||||
}
|
||||
|
||||
func (e *Export) GetId() string {
|
||||
@@ -30,8 +30,8 @@ func (e *Export) GetTarget() string {
|
||||
return e.Target
|
||||
}
|
||||
|
||||
func (e *Export) GetFilter() interfaces.Filter {
|
||||
return e.Filter
|
||||
func (e *Export) GetQuery() bson.M {
|
||||
return e.Query
|
||||
}
|
||||
|
||||
func (e *Export) GetStatus() string {
|
||||
|
||||
Reference in New Issue
Block a user