|
@@ -156,24 +156,27 @@ func (listIntervalService *ListIntervalService) UpdateListInterval(updateListInt |
|
@@ -156,24 +156,27 @@ func (listIntervalService *ListIntervalService) UpdateListInterval(updateListInt |
156
|
listIntervalRepository = value
|
156
|
listIntervalRepository = value
|
157
|
}
|
157
|
}
|
158
|
|
158
|
|
159
|
- listInterval, err := listIntervalRepository.FindOne(map[string]interface{}{"listId": updateListIntervalCommand.ListIntervalId})
|
159
|
+ listIntervalFound, err := listIntervalRepository.FindOne(map[string]interface{}{"listId": updateListIntervalCommand.ListIntervalId})
|
160
|
if err != nil {
|
160
|
if err != nil {
|
161
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
161
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
162
|
}
|
162
|
}
|
163
|
- if listInterval == nil {
|
163
|
+ if listIntervalFound == nil {
|
164
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateListIntervalCommand.ListIntervalId)))
|
164
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateListIntervalCommand.ListIntervalId)))
|
165
|
}
|
165
|
}
|
166
|
- if err := listInterval.Update(tool_funs.SimpleStructToMap(updateListIntervalCommand)); err != nil {
|
166
|
+
|
|
|
167
|
+ fmt.Printf("Command: %+v\n", updateListIntervalCommand)
|
|
|
168
|
+
|
|
|
169
|
+ if err := listIntervalFound.Update(tool_funs.SimpleStructToMap(updateListIntervalCommand)); err != nil {
|
167
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
170
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
168
|
}
|
171
|
}
|
169
|
|
172
|
|
170
|
- if listInterval, err := listIntervalRepository.Save(listInterval); err != nil {
|
173
|
+ if listIntervalUpdated, err := listIntervalRepository.Save(listIntervalFound); err != nil {
|
171
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
174
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
172
|
} else {
|
175
|
} else {
|
173
|
if err := transactionContext.CommitTransaction(); err != nil {
|
176
|
if err := transactionContext.CommitTransaction(); err != nil {
|
174
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
177
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
175
|
}
|
178
|
}
|
176
|
- return listInterval, nil
|
179
|
+ return listIntervalUpdated, nil
|
177
|
}
|
180
|
}
|
178
|
}
|
181
|
}
|
179
|
|
182
|
|