(input *plugin.ApiResourceInput)
| 102 | } |
| 103 | |
| 104 | func (scopeApi *DsScopeApiHelper[C, S, SC]) PutMultiple(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) { |
| 105 | // fix data[].connectionId |
| 106 | connectionId, err := extractConnectionId(input) |
| 107 | if err != nil { |
| 108 | return nil, err |
| 109 | } |
| 110 | data, ok := input.Body["data"].([]interface{}) |
| 111 | if !ok { |
| 112 | return nil, errors.BadInput.New("invalid data") |
| 113 | } |
| 114 | for _, row := range data { |
| 115 | dict, ok := row.(map[string]interface{}) |
| 116 | if !ok { |
| 117 | return nil, errors.BadInput.New("invalid data row") |
| 118 | } |
| 119 | dict["connectionId"] = connectionId |
| 120 | } |
| 121 | return scopeApi.ModelApiHelper.PutMultipleCb(input, func(m *S) errors.Error { |
| 122 | ok := setRawDataOrigin(m, common.RawDataOrigin{ |
| 123 | RawDataTable: fmt.Sprintf("_raw_%s_scopes", scopeApi.GetPluginName()), |
| 124 | RawDataParams: plugin.MarshalScopeParams((*m).ScopeParams()), |
| 125 | }) |
| 126 | if !ok { |
| 127 | panic("set raw data origin failed") |
| 128 | } |
| 129 | return nil |
| 130 | }) |
| 131 | } |
| 132 | |
| 133 | func (scopeApi *DsScopeApiHelper[C, S, SC]) Delete(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) { |
| 134 | var scope *S |
no test coverage detected