Skip to content

Commit

Permalink
fix: Fix missing AutoTriggerMissedRecords for patching schedule job
Browse files Browse the repository at this point in the history
Fix missing AutoTriggerMissedRecords for patching schedule job in ReplaceScheduleJobModelFieldsWithDTO.

Signed-off-by: Jack Chen <[email protected]>
  • Loading branch information
jackchenjc committed Sep 9, 2024
1 parent 40089cd commit eafdce7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
3 changes: 3 additions & 0 deletions dtos/requests/schedulejob.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ func ReplaceScheduleJobModelFieldsWithDTO(ds *models.ScheduleJob, patch dtos.Upd
if patch.AdminState != nil {
ds.AdminState = models.AdminState(*patch.AdminState)
}
if patch.AutoTriggerMissedRecords != nil {
ds.AutoTriggerMissedRecords = *patch.AutoTriggerMissedRecords
}
if patch.Labels != nil {
ds.Labels = patch.Labels
}
Expand Down
14 changes: 9 additions & 5 deletions dtos/requests/schedulejob_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ var (
},
},
}
testAutoTriggerMissedRecords = true
)

func addScheduleJobRequestData() AddScheduleJobRequest {
Expand All @@ -64,12 +65,14 @@ func updateScheduleJobData() dtos.UpdateScheduleJob {
definition := testScheduleDef
actions := testScheduleActions
labels := testScheduleJobLabels
autoTriggerMissedRecords := testAutoTriggerMissedRecords
return dtos.UpdateScheduleJob{
Id: &id,
Name: &name,
Definition: &definition,
Actions: actions,
Labels: labels,
Id: &id,
Name: &name,
Definition: &definition,
Actions: actions,
AutoTriggerMissedRecords: &autoTriggerMissedRecords,
Labels: labels,
}
}

Expand Down Expand Up @@ -262,5 +265,6 @@ func TestReplaceScheduleJobModelFieldsWithDTO(t *testing.T) {
expectedDef := dtos.ToScheduleDefModel(*patch.Definition)
assert.Equal(t, testScheduleJobName, job.Name)
assert.Equal(t, expectedActions, job.Actions)
assert.Equal(t, testAutoTriggerMissedRecords, job.AutoTriggerMissedRecords)
assert.Equal(t, expectedDef, job.Definition)
}

0 comments on commit eafdce7

Please sign in to comment.