mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
fix: retention delete backup cron action
This commit is contained in:
@@ -22,8 +22,6 @@ export async function enforceRetentionCount(databaseId: string, count: number) {
|
||||
await deleteBackupCronAction({
|
||||
backupId: b.id,
|
||||
databaseId: b.databaseId,
|
||||
file: b.file ?? "",
|
||||
projectSlug: b.database.project?.slug!
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -25,8 +25,6 @@ export async function enforceRetentionDays(databaseId: string, days: number) {
|
||||
await deleteBackupCronAction({
|
||||
backupId: backup.id,
|
||||
databaseId: backup.databaseId,
|
||||
file: backup.file ?? "",
|
||||
projectSlug: backup.database.project?.slug!
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -30,14 +30,6 @@ export async function enforceRetentionGFS(databaseId: string, gfsSettings: {
|
||||
if (b.createdAt >= subDays(now, gfsSettings.daily)) toKeep.add(b.id);
|
||||
});
|
||||
|
||||
// WEEKLY
|
||||
// const weekStartDates = Array.from({length: gfsSettings.weekly}, (_, i) => startOfWeek(subWeeks(now, i)));
|
||||
// weekStartDates.forEach((weekStart) => {
|
||||
// const backupOfWeek = backups.find(
|
||||
// (b) => b.createdAt >= weekStart && b.createdAt < subWeeks(weekStart, -1)
|
||||
// );
|
||||
// if (backupOfWeek) toKeep.add(backupOfWeek.id);
|
||||
// });
|
||||
const weekStartDates = Array.from({length: gfsSettings.weekly}, (_, i) => startOfWeek(subWeeks(now, i), { weekStartsOn: 1 }));
|
||||
weekStartDates.forEach((weekStart) => {
|
||||
const backupOfWeek = backups.find(
|
||||
@@ -46,9 +38,6 @@ export async function enforceRetentionGFS(databaseId: string, gfsSettings: {
|
||||
if (backupOfWeek) toKeep.add(backupOfWeek.id);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
// MONTHLY
|
||||
const monthStartDates = Array.from({length: gfsSettings.monthly}, (_, i) => startOfMonth(subMonths(now, i)));
|
||||
monthStartDates.forEach((monthStart) => {
|
||||
@@ -74,8 +63,6 @@ export async function enforceRetentionGFS(databaseId: string, gfsSettings: {
|
||||
await deleteBackupCronAction({
|
||||
backupId: b.id,
|
||||
databaseId: b.databaseId,
|
||||
file: b.file ?? "",
|
||||
projectSlug: b.database.project?.slug!
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,8 +16,6 @@ export const deleteBackupCronAction = action
|
||||
z.object({
|
||||
backupId: z.string(),
|
||||
databaseId: z.string(),
|
||||
projectSlug: z.string(),
|
||||
file: z.string(),
|
||||
})
|
||||
)
|
||||
.action(async ({parsedInput}): Promise<ServerActionResult<Backup>> => {
|
||||
|
||||
Reference in New Issue
Block a user