From 7c42d68ad79b318f4af5b99eac3f947cd2e3156f Mon Sep 17 00:00:00 2001 From: Marvin Zhang Date: Wed, 19 Jun 2024 15:50:30 +0800 Subject: [PATCH] feat: added fields for git --- core/controllers/utils_http.go | 4 ++++ core/models/models/git_v2.go | 17 +++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/core/controllers/utils_http.go b/core/controllers/utils_http.go index 4726f288..a26f4ea1 100644 --- a/core/controllers/utils_http.go +++ b/core/controllers/utils_http.go @@ -31,6 +31,10 @@ func HandleErrorBadRequest(c *gin.Context, err error) { HandleError(http.StatusBadRequest, c, err) } +func HandleErrorForbidden(c *gin.Context, err error) { + HandleError(http.StatusForbidden, c, err) +} + func HandleErrorUnauthorized(c *gin.Context, err error) { HandleError(http.StatusUnauthorized, c, err) } diff --git a/core/models/models/git_v2.go b/core/models/models/git_v2.go index 2351882a..7e4347fd 100644 --- a/core/models/models/git_v2.go +++ b/core/models/models/git_v2.go @@ -3,14 +3,15 @@ package models type GitV2 struct { any `collection:"gits"` BaseModelV2[GitV2] `bson:",inline"` - Url string `json:"url" bson:"url"` - Name string `json:"name" bson:"name"` - AuthType string `json:"auth_type" bson:"auth_type"` - Username string `json:"username" bson:"username"` - Password string `json:"password" bson:"password"` - CurrentBranch string `json:"current_branch" bson:"current_branch"` - Status string `json:"status" bson:"status"` - Error string `json:"error" bson:"error"` + Url string `json:"url" bson:"url"` + Name string `json:"name" bson:"name"` + AuthType string `json:"auth_type" bson:"auth_type"` + Username string `json:"username" bson:"username"` + Password string `json:"password" bson:"password"` + CurrentBranch string `json:"current_branch" bson:"current_branch"` + Status string `json:"status" bson:"status"` + Error string `json:"error" bson:"error"` + Spiders []SpiderV2 `json:"spiders,omitempty" bson:"-"` // settings AutoPull bool `json:"auto_pull" bson:"auto_pull"`