namespace set default 0

This commit is contained in:
zhenorzz 2023-07-17 15:33:41 +08:00
parent 730c310e2d
commit df3f4d749e
3 changed files with 10 additions and 7 deletions

View File

@ -37,7 +37,7 @@ func (u User) Handler() []server.Route {
server.NewRoute("/user/add", http.MethodPost, u.Add).Permissions(config.AddMember).LogFunc(middleware.AddOPLog),
server.NewRoute("/user/edit", http.MethodPut, u.Edit).Permissions(config.EditMember).LogFunc(middleware.AddOPLog),
server.NewRoute("/user/remove", http.MethodDelete, u.Remove).Permissions(config.DeleteMember).LogFunc(middleware.AddOPLog),
server.NewWhiteRoute("/user/mediaLogin", http.MethodPost, u.MediaLogin),
server.NewWhiteRoute("/user/mediaLogin", http.MethodPost, u.MediaLogin).LogFunc(middleware.AddLoginLog),
server.NewWhiteRoute("/user/getMediaLoginUrl", http.MethodGet, u.GetMediaLoginUrl),
}
}

View File

@ -1,8 +1,8 @@
ALTER TABLE `project`
MODIFY COLUMN `after_deploy_script_mode` varchar(20) NOT NULL DEFAULT '' COMMENT 'deprecated after v1.15.0' AFTER `review_url`,
MODIFY COLUMN `after_deploy_script` text NOT NULL COMMENT 'deprecated after v1.15.0' AFTER `after_deploy_script_mode`,
MODIFY COLUMN `after_deploy_script` text COMMENT 'deprecated after v1.15.0' AFTER `after_deploy_script_mode`,
MODIFY COLUMN `after_pull_script_mode` varchar(20) NOT NULL DEFAULT '' COMMENT 'deprecated after v1.15.0' AFTER `after_deploy_script`,
MODIFY COLUMN `after_pull_script` text NOT NULL COMMENT 'deprecated after v1.15.0' AFTER `after_pull_script_mode`,
MODIFY COLUMN `after_pull_script` text COMMENT 'deprecated after v1.15.0' AFTER `after_pull_script_mode`,
ADD COLUMN `script` json NOT NULL COMMENT 'script' AFTER `review_url`;
UPDATE project

View File

@ -94,10 +94,13 @@ func (rt *Router) doRequest(w http.ResponseWriter, r *http.Request) (*Goploy, Re
if namespaceIDRaw == "" {
namespaceIDRaw = r.URL.Query().Get(config.NamespaceHeaderName)
}
namespaceID, err := strconv.ParseInt(namespaceIDRaw, 10, 64)
if err != nil {
return gp, response.JSON{Code: response.Deny, Message: "Invalid namespace"}
var namespaceID int64
if namespaceIDRaw != "" {
_id, err := strconv.ParseInt(namespaceIDRaw, 10, 64)
if err != nil {
return gp, response.JSON{Code: response.Deny, Message: "Invalid namespace"}
}
namespaceID = _id
}
apiKey := r.Header.Get(config.ApiKeyHeaderName)