Update try
This commit is contained in:
@@ -29,12 +29,14 @@ func NewAccessor(request *tools.APIRequest) *BookingMongoAccessor {
|
||||
/*
|
||||
* Nothing special here, just the basic CRUD operations
|
||||
*/
|
||||
func (a *BookingMongoAccessor) UpdateOne(set utils.DBObject, id string) (utils.DBObject, int, error) {
|
||||
if set.(*Booking).State == 0 {
|
||||
func (a *BookingMongoAccessor) UpdateOne(set map[string]interface{}, id string) (utils.DBObject, int, error) {
|
||||
if set["state"] == nil {
|
||||
return nil, 400, errors.New("state is required")
|
||||
}
|
||||
realSet := &Booking{State: set.(*Booking).State}
|
||||
return utils.GenericUpdateOne(realSet, id, a, &Booking{})
|
||||
set = map[string]interface{}{
|
||||
"state": set["state"],
|
||||
}
|
||||
return utils.GenericUpdateOne(set, id, a, &Booking{})
|
||||
}
|
||||
|
||||
func (a *BookingMongoAccessor) LoadOne(id string) (utils.DBObject, int, error) {
|
||||
|
||||
Reference in New Issue
Block a user