mirror of
https://github.com/nicotsx/zerobyte.git
synced 2026-06-03 21:59:36 -04:00
27 lines
722 B
TypeScript
27 lines
722 B
TypeScript
import { db } from "~/server/db/db";
|
|
import { backupScheduleMirrorsTable, type BackupScheduleMirror } from "~/server/db/schema";
|
|
import { ensureTestOrganization } from "./organization";
|
|
|
|
type BackupScheduleMirrorInsert = Omit<BackupScheduleMirror, 'id' | 'createdAt'>;
|
|
|
|
export const createTestBackupScheduleMirror = async (
|
|
scheduleId: number,
|
|
repositoryId: string,
|
|
overrides: Partial<BackupScheduleMirrorInsert> = {},
|
|
) => {
|
|
await ensureTestOrganization();
|
|
|
|
const mirror = {
|
|
scheduleId,
|
|
repositoryId,
|
|
enabled: true,
|
|
lastCopyAt: null,
|
|
lastCopyStatus: null,
|
|
lastCopyError: null,
|
|
...overrides,
|
|
};
|
|
|
|
const data = await db.insert(backupScheduleMirrorsTable).values(mirror).returning();
|
|
return data[0];
|
|
};
|