update amo repo methods

This commit is contained in:
Pavel 2024-04-22 17:48:44 +03:00
parent 4ca35ec382
commit bb9fb36a60

@ -314,12 +314,10 @@ func (r *AmoRepository) CheckPipelines(ctx context.Context, pipelines []model.Pi
var toUpdate []model.Pipeline var toUpdate []model.Pipeline
for _, row := range rows { for _, row := range rows {
to := model.Pipeline{ to := model.Pipeline{
ID: row.ID,
Amoid: row.Amoid, Amoid: row.Amoid,
AccountID: row.Accountid, AccountID: row.Accountid,
Name: row.Name, Name: row.Name,
Isarchive: row.Isarchive, Isarchive: row.Isarchive,
Createdat: row.Createdat.Time.Unix(),
} }
toUpdate = append(toUpdate, to) toUpdate = append(toUpdate, to)
} }
@ -389,13 +387,11 @@ func (r *AmoRepository) CheckSteps(ctx context.Context, steps []model.Step) erro
var toUpdate []model.Step var toUpdate []model.Step
for _, row := range rows { for _, row := range rows {
to := model.Step{ to := model.Step{
ID: row.ID,
Amoid: row.Amoid, Amoid: row.Amoid,
Pipelineid: row.Pipelineid, Pipelineid: row.Pipelineid,
Accountid: row.Accountid, Accountid: row.Accountid,
Name: row.Name, Name: row.Name,
Color: row.Color, Color: row.Color,
Createdat: row.Createdat.Time.Unix(),
} }
toUpdate = append(toUpdate, to) toUpdate = append(toUpdate, to)
} }
@ -473,13 +469,11 @@ func (r *AmoRepository) CheckTags(ctx context.Context, tags []model.Tag, tokenID
v := string(row.Entity.([]byte)) v := string(row.Entity.([]byte))
entity = model.EntityType(v) entity = model.EntityType(v)
to := model.Tag{ to := model.Tag{
ID: row.ID,
Amoid: row.Amoid, Amoid: row.Amoid,
Accountid: row.Accountid, Accountid: row.Amoid_2,
Entity: entity, Entity: entity,
Name: row.Name, Name: row.Name,
Color: &row.Color, Color: &row.Color,
Createdat: row.Createdat.Time.Unix(),
} }
toUpdate = append(toUpdate, to) toUpdate = append(toUpdate, to)
} }
@ -567,13 +561,11 @@ func (r *AmoRepository) CheckFields(ctx context.Context, fields []model.Field, t
v := string(row.Entity.([]byte)) v := string(row.Entity.([]byte))
entity = model.EntityType(v) entity = model.EntityType(v)
to := model.Field{ to := model.Field{
ID: row.ID,
Amoid: row.Amoid, Amoid: row.Amoid,
Code: row.Code, Code: row.Code,
Accountid: row.Accountid, Accountid: row.Amoid_2,
Entity: entity, Entity: entity,
Type: row.Type, Type: row.Type,
Createdat: row.Createdat.Time.Unix(),
} }
toUpdate = append(toUpdate, to) toUpdate = append(toUpdate, to)
} }