Update try
This commit is contained in:
@@ -55,12 +55,10 @@ func NewAccessor[T ResourceInterface](t tools.DataType, request *tools.APIReques
|
||||
* Nothing special here, just the basic CRUD operations
|
||||
*/
|
||||
|
||||
func (dca *ResourceMongoAccessor[T]) UpdateOne(set utils.DBObject, id string) (utils.DBObject, int, error) {
|
||||
func (dca *ResourceMongoAccessor[T]) UpdateOne(set map[string]interface{}, id string) (utils.DBObject, int, error) {
|
||||
if dca.GetType() == tools.COMPUTE_RESOURCE {
|
||||
return nil, 404, errors.New("can't update a non existing computing units resource not reported onto compute units catalog")
|
||||
}
|
||||
set.(T).Trim()
|
||||
|
||||
if d, c, err := utils.GenericUpdateOne(set, id, dca, dca.generateData()); err != nil {
|
||||
return d, c, err
|
||||
} else {
|
||||
@@ -72,7 +70,6 @@ func (dca *ResourceMongoAccessor[T]) StoreOne(data utils.DBObject) (utils.DBObje
|
||||
if dca.GetType() == tools.COMPUTE_RESOURCE {
|
||||
return nil, 404, errors.New("can't create a non existing computing units resource not reported onto compute units catalog")
|
||||
}
|
||||
data.(T).Trim()
|
||||
return utils.GenericStoreOne(data, dca)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user