...
|
...
|
@@ -28,11 +28,13 @@ func (listIntervalService *ListIntervalService) CreateListInterval(createListInt |
|
|
defer func() {
|
|
|
transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
newListInterval := &domain.ListInterval {
|
|
|
CompanyId: createListIntervalCommand.CompanyId,
|
|
|
IntervalStartTime: createListIntervalCommand.ListIntervalStartTime,
|
|
|
IntervalEndTime: createListIntervalCommand.ListIntervalEndTime,
|
|
|
}
|
|
|
|
|
|
var listIntervalRepository domain.ListIntervalRepository
|
|
|
if value, err := factory.CreateListIntervalRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
...
|
...
|
@@ -41,6 +43,7 @@ func (listIntervalService *ListIntervalService) CreateListInterval(createListInt |
|
|
} else {
|
|
|
listIntervalRepository = value
|
|
|
}
|
|
|
|
|
|
if listInterval, err := listIntervalRepository.Save(newListInterval); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
...
|
...
|
@@ -66,6 +69,7 @@ func (listIntervalService *ListIntervalService) ListListInterval(listListInterva |
|
|
defer func() {
|
|
|
transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
var listIntervalRepository domain.ListIntervalRepository
|
|
|
if value, err := factory.CreateListIntervalRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
...
|
...
|
@@ -74,6 +78,7 @@ func (listIntervalService *ListIntervalService) ListListInterval(listListInterva |
|
|
} else {
|
|
|
listIntervalRepository = value
|
|
|
}
|
|
|
|
|
|
if count, listIntervals, err := listIntervalRepository.Find(tool_funs.SimpleStructToMap(listListIntervalQuery)); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
...
|
...
|
@@ -102,6 +107,7 @@ func (listIntervalService *ListIntervalService) GetListInterval(getListIntervalQ |
|
|
defer func() {
|
|
|
transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
var listIntervalRepository domain.ListIntervalRepository
|
|
|
if value, err := factory.CreateListIntervalRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
...
|
...
|
@@ -110,6 +116,7 @@ func (listIntervalService *ListIntervalService) GetListInterval(getListIntervalQ |
|
|
} else {
|
|
|
listIntervalRepository = value
|
|
|
}
|
|
|
|
|
|
listInterval, err := listIntervalRepository.FindOne(map[string]interface{}{"listId": getListIntervalQuery.ListIntervalId})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
...
|
...
|
@@ -139,6 +146,7 @@ func (listIntervalService *ListIntervalService) UpdateListInterval(updateListInt |
|
|
defer func() {
|
|
|
transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
var listIntervalRepository domain.ListIntervalRepository
|
|
|
if value, err := factory.CreateListIntervalRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
...
|
...
|
@@ -147,6 +155,7 @@ func (listIntervalService *ListIntervalService) UpdateListInterval(updateListInt |
|
|
} else {
|
|
|
listIntervalRepository = value
|
|
|
}
|
|
|
|
|
|
listInterval, err := listIntervalRepository.FindOne(map[string]interface{}{"listId": updateListIntervalCommand.ListIntervalId})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
...
|
...
|
@@ -157,6 +166,7 @@ func (listIntervalService *ListIntervalService) UpdateListInterval(updateListInt |
|
|
if err := listInterval.Update(tool_funs.SimpleStructToMap(updateListIntervalCommand)); err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
if listInterval, err := listIntervalRepository.Save(listInterval); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
...
|
...
|
@@ -182,6 +192,7 @@ func (listIntervalService *ListIntervalService) RemoveListInterval(removeListInt |
|
|
defer func() {
|
|
|
transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
var listIntervalRepository domain.ListIntervalRepository
|
|
|
if value, err := factory.CreateListIntervalRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
...
|
...
|
@@ -190,6 +201,7 @@ func (listIntervalService *ListIntervalService) RemoveListInterval(removeListInt |
|
|
} else {
|
|
|
listIntervalRepository = value
|
|
|
}
|
|
|
|
|
|
listInterval, err := listIntervalRepository.FindOne(map[string]interface{}{"listId": removeListIntervalCommand.ListIntervalId})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
...
|
...
|
@@ -197,6 +209,7 @@ func (listIntervalService *ListIntervalService) RemoveListInterval(removeListInt |
|
|
if listInterval == nil {
|
|
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(removeListIntervalCommand.ListIntervalId)))
|
|
|
}
|
|
|
|
|
|
if listInterval, err := listIntervalRepository.Remove(listInterval); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
...
|
...
|
|