Skip to content

Commit

Permalink
fix: send schedules undefined when none present (#459)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabio-silva authored Jun 27, 2024
1 parent f15a92f commit 622ace2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
21 changes: 11 additions & 10 deletions ui/apps/everest/src/hooks/api/db-cluster/useCreateDbCluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,17 @@ const formValuesToPayloadMapping = (
: dbPayload.pitrStorageLocation!.name,
},
}),
...(dbPayload.schedules?.length > 0 && {
schedules: dbPayload.schedules.map((schedule) => ({
...schedule,
schedule: cronConverter(
schedule.schedule,
Intl.DateTimeFormat().resolvedOptions().timeZone,
'UTC'
),
})),
}),
schedules:
dbPayload.schedules?.length > 0
? dbPayload.schedules.map((schedule) => ({
...schedule,
schedule: cronConverter(
schedule.schedule,
Intl.DateTimeFormat().resolvedOptions().timeZone,
'UTC'
),
}))
: undefined,
},
engine: {
type: dbTypeToDbEngine(dbPayload.dbType),
Expand Down
21 changes: 11 additions & 10 deletions ui/apps/everest/src/hooks/api/db-cluster/useUpdateDbCluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,17 @@ const formValuesToPayloadOverrides = (
enabled: dbPayload.pitrEnabled,
backupStorageName: pitrBackupStorageName,
},
...(dbPayload.schedules?.length > 0 && {
schedules: dbPayload.schedules.map((schedule) => ({
...schedule,
schedule: cronConverter(
schedule.schedule,
Intl.DateTimeFormat().resolvedOptions().timeZone,
'UTC'
),
})),
}),
schedules:
dbPayload.schedules.length > 0
? dbPayload.schedules.map((schedule) => ({
...schedule,
schedule: cronConverter(
schedule.schedule,
Intl.DateTimeFormat().resolvedOptions().timeZone,
'UTC'
),
}))
: undefined,
},
engine: {
...dbCluster.spec.engine,
Expand Down

0 comments on commit 622ace2

Please sign in to comment.