...
|
...
|
@@ -26,27 +26,29 @@ func NewTaskRepository(transactionContext *pgTransaction.TransactionContext) *Ta |
|
|
|
|
|
func (repo *TaskRepository) TransformToDomain(d *models.Task) *domain.Task {
|
|
|
return &domain.Task{
|
|
|
Id: d.Id,
|
|
|
CreatedAt: d.CreatedAt,
|
|
|
UpdatedAt: d.UpdatedAt,
|
|
|
DeletedAt: d.DeletedAt,
|
|
|
CompanyId: d.CompanyId,
|
|
|
Name: d.Name,
|
|
|
Alias: d.Alias,
|
|
|
Leader: d.Leader,
|
|
|
Status: domain.TaskState(d.Status),
|
|
|
Level: d.Level,
|
|
|
LevelName: d.LevelName,
|
|
|
SortBy: domain.TaskSortBy(d.SortBy),
|
|
|
EndTime: d.EndTime,
|
|
|
UseEndTime: d.UseEndTime,
|
|
|
RelatedUser: d.RelatedUser,
|
|
|
RunAt: d.RunAt,
|
|
|
StopAt: d.StopAt,
|
|
|
Anomaly: d.Anomaly,
|
|
|
WarnFlag: domain.TaskWarnFlag(d.WarnFlag),
|
|
|
CurrentStage: d.CurrentStage,
|
|
|
LastStage: d.LastStage,
|
|
|
Id: d.Id,
|
|
|
CreatedAt: d.CreatedAt,
|
|
|
UpdatedAt: d.UpdatedAt,
|
|
|
DeletedAt: d.DeletedAt,
|
|
|
CompanyId: d.CompanyId,
|
|
|
Name: d.Name,
|
|
|
Alias: d.Alias,
|
|
|
Leader: d.Leader,
|
|
|
Status: domain.TaskState(d.Status),
|
|
|
Level: d.Level,
|
|
|
LevelName: d.LevelName,
|
|
|
SortBy: domain.TaskSortBy(d.SortBy),
|
|
|
EndTime: d.EndTime,
|
|
|
UseEndTime: d.UseEndTime,
|
|
|
RelatedUser: d.RelatedUser,
|
|
|
RunAt: d.RunAt,
|
|
|
StopAt: d.StopAt,
|
|
|
Anomaly: d.Anomaly,
|
|
|
WarnFlag: domain.TaskWarnFlag(d.WarnFlag),
|
|
|
AssistFlag: d.AssistFlag,
|
|
|
AssistFlagMax: d.AssistFlagMax,
|
|
|
CurrentStage: d.CurrentStage,
|
|
|
LastStage: d.LastStage,
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -56,27 +58,29 @@ func (repo *TaskRepository) Save(param *domain.Task) error { |
|
|
param.CreatedAt = time.Now()
|
|
|
}
|
|
|
m := models.Task{
|
|
|
Id: param.Id,
|
|
|
CreatedAt: param.CreatedAt,
|
|
|
UpdatedAt: param.UpdatedAt,
|
|
|
DeletedAt: param.DeletedAt,
|
|
|
Name: param.Name,
|
|
|
Alias: param.Alias,
|
|
|
CompanyId: param.CompanyId,
|
|
|
Leader: param.Leader,
|
|
|
Status: int(param.Status),
|
|
|
Level: param.Level,
|
|
|
LevelName: param.LevelName,
|
|
|
RelatedUser: param.RelatedUser,
|
|
|
LastStage: param.LastStage,
|
|
|
RunAt: param.RunAt,
|
|
|
StopAt: param.StopAt,
|
|
|
Anomaly: param.Anomaly,
|
|
|
WarnFlag: int(param.WarnFlag),
|
|
|
CurrentStage: param.CurrentStage,
|
|
|
SortBy: int(param.SortBy),
|
|
|
EndTime: param.EndTime,
|
|
|
UseEndTime: param.UseEndTime,
|
|
|
Id: param.Id,
|
|
|
CreatedAt: param.CreatedAt,
|
|
|
UpdatedAt: param.UpdatedAt,
|
|
|
DeletedAt: param.DeletedAt,
|
|
|
Name: param.Name,
|
|
|
Alias: param.Alias,
|
|
|
CompanyId: param.CompanyId,
|
|
|
Leader: param.Leader,
|
|
|
Status: int(param.Status),
|
|
|
Level: param.Level,
|
|
|
LevelName: param.LevelName,
|
|
|
RelatedUser: param.RelatedUser,
|
|
|
LastStage: param.LastStage,
|
|
|
RunAt: param.RunAt,
|
|
|
StopAt: param.StopAt,
|
|
|
Anomaly: param.Anomaly,
|
|
|
WarnFlag: int(param.WarnFlag),
|
|
|
CurrentStage: param.CurrentStage,
|
|
|
SortBy: int(param.SortBy),
|
|
|
EndTime: param.EndTime,
|
|
|
UseEndTime: param.UseEndTime,
|
|
|
AssistFlag: param.AssistFlag,
|
|
|
AssistFlagMax: param.AssistFlagMax,
|
|
|
}
|
|
|
db := repo.transactionContext.PgTx
|
|
|
if m.Id == 0 {
|
...
|
...
|
|