MCPcopy
hub / github.com/apache/devlake / Post

Method Post

backend/helpers/pluginhelper/api/model_api_helper.go:66–81  ·  view source on GitHub ↗
(input *plugin.ApiResourceInput)

Source from the content-addressed store, hash-verified

64}
65
66func (self *ModelApiHelper[M]) Post(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) {
67 model := new(M)
68 err := DecodeMapStruct(input.Body, model, false)
69 if err != nil {
70 return nil, err
71 }
72 err = self.dalHelper.Create(model)
73 if err != nil {
74 return nil, err
75 }
76 model = self.Sanitize(model)
77 return &plugin.ApiResourceOutput{
78 Status: http.StatusCreated,
79 Body: model,
80 }, nil
81}
82
83func (self *ModelApiHelper[M]) ExtractPkValues(input *plugin.ApiResourceInput) ([]interface{}, errors.Error) {
84 pkv := make([]interface{}, len(self.pkPathVarNames))

Callers

nothing calls this directly

Calls 3

SanitizeMethod · 0.95
DecodeMapStructFunction · 0.70
CreateMethod · 0.65

Tested by

no test coverage detected