...
|
...
|
@@ -62,6 +62,9 @@ func (rs *EvaluationCycleService) Create(in *command.CreateCycleCommand) (interf |
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
ctAdapter := &adapter.CycleTemplateAdapter{}
|
|
|
ctAdapter.EvaluationCycle = cycle
|
|
|
|
|
|
for i := range templates {
|
|
|
v := templates[i]
|
|
|
cycleTemplate := &domain.EvaluationCycleTemplate{
|
...
|
...
|
@@ -74,12 +77,18 @@ func (rs *EvaluationCycleService) Create(in *command.CreateCycleCommand) (interf |
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
ctAdapter.TemplateSimples = append(ctAdapter.TemplateSimples, &domain.TemplateSimple{
|
|
|
Id: v.Id,
|
|
|
Name: v.Name,
|
|
|
CreatedAt: v.CreatedAt,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
return cycle, nil
|
|
|
return ctAdapter, nil
|
|
|
|
|
|
}
|
|
|
|
...
|
...
|
@@ -166,10 +175,26 @@ func (rs *EvaluationCycleService) Update(in *command.UpdateCycleCommand) (interf |
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
_, cycleTemplates, err := cycleTemplateRepository.Find(map[string]interface{}{"cycleId": cycle.Id}, "template")
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
ctAdapter := &adapter.CycleTemplateAdapter{}
|
|
|
ctAdapter.EvaluationCycle = cycle
|
|
|
for i := range cycleTemplates {
|
|
|
ctAdapter.TemplateSimples = append(ctAdapter.TemplateSimples, &domain.TemplateSimple{
|
|
|
Id: cycleTemplates[i].Id,
|
|
|
Name: cycleTemplates[i].Name,
|
|
|
CreatedAt: cycleTemplates[i].CreatedAt,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
return cycle, nil
|
|
|
return ctAdapter, nil
|
|
|
}
|
|
|
|
|
|
func (rs *EvaluationCycleService) Get(in *command.GetCycleCommand) (interface{}, error) {
|
...
|
...
|
|