Update still not workin
This commit is contained in:
parent
045f3471ec
commit
c5f4427f9f
@ -72,17 +72,12 @@ func (dma *AbstractAccessor) GenericDeleteOne(id string, accessor Accessor) (DBO
|
||||
}
|
||||
|
||||
func (dma *AbstractAccessor) GenericUpdateOne(set DBObject, id string, accessor Accessor) (DBObject, int, error) {
|
||||
changeMap := set.Serialize()
|
||||
r, c, err := accessor.LoadOne(id)
|
||||
if err != nil {
|
||||
return nil, c, err
|
||||
}
|
||||
original := r.Serialize()
|
||||
for k, v := range changeMap {
|
||||
original[k] = v
|
||||
}
|
||||
fmt.Println(original)
|
||||
id, code, err := mongo.MONGOService.UpdateOne(r.Deserialize(original), id, accessor.GetType())
|
||||
fmt.Println(set.Serialize())
|
||||
id, code, err := mongo.MONGOService.UpdateOne(r.Deserialize(set.Serialize()), id, accessor.GetType())
|
||||
if err != nil {
|
||||
dma.Logger.Error().Msg("Could not update " + id + " to db. Error: " + err.Error())
|
||||
return nil, code, err
|
||||
|
Loading…
Reference in New Issue
Block a user