MCPcopy Create free account
hub / github.com/apache/devlake / PutScope

Function PutScope

backend/plugins/sonarqube/api/scope_api.go:43–64  ·  view source on GitHub ↗

PutScope create or update sonarqube project @Summary create or update sonarqube project @Description Create or update sonarqube project @Tags plugins/sonarqube @Accept application/json @Param connectionId path int false "connection ID" @Param scope body PutScopesReqBody true "json" @Success 200 {ob

(input *plugin.ApiResourceInput)

Source from the content-addressed store, hash-verified

41// @Failure 500 {object} shared.ApiBody "Internal Error"
42// @Router /plugins/sonarqube/connections/{connectionId}/scopes [PUT]
43func PutScope(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) {
44 // decode request body to scope, deal with lastAnalysisDate format
45 data, ok := input.Body["data"].([]interface{})
46 if !ok {
47 return nil, errors.BadInput.New("invalid `data`")
48 }
49 for _, item := range data {
50 dateStr, ok := item.(map[string]interface{})["lastAnalysisDate"].(string)
51 if !ok {
52 continue
53 }
54 timeObj, err := common.ConvertStringToTime(dateStr)
55 if err != nil {
56 panic(err)
57 }
58
59 item.(map[string]interface{})["lastAnalysisDate"] = timeObj
60
61 }
62
63 return dsHelper.ScopeApi.PutMultiple(input)
64}
65
66// UpdateScope patch to sonarqube project
67// @Summary patch to sonarqube project

Callers

nothing calls this directly

Calls 2

PutMultipleMethod · 0.80
NewMethod · 0.65

Tested by

no test coverage detected