diff --git a/src/lib/utils/config-mapper.ts b/src/lib/utils/config-mapper.ts index 512986c..685f8dc 100644 --- a/src/lib/utils/config-mapper.ts +++ b/src/lib/utils/config-mapper.ts @@ -38,6 +38,7 @@ export function mapUiToDbConfig( includeStarred: githubConfig.mirrorStarred, includePrivate: githubConfig.privateRepositories, includeForks: !advancedOptions.skipForks, // Note: UI has skipForks, DB has includeForks + skipForks: advancedOptions.skipForks, // Add skipForks field includeArchived: false, // Not in UI yet, default to false includePublic: true, // Not in UI yet, default to true @@ -60,6 +61,8 @@ export function mapUiToDbConfig( url: giteaConfig.url, token: giteaConfig.token, defaultOwner: giteaConfig.username, // Map username to defaultOwner + organization: giteaConfig.organization, // Add organization field + preserveOrgStructure: giteaConfig.mirrorStrategy === "preserve" || giteaConfig.mirrorStrategy === "mixed", // Add preserveOrgStructure field // Mirror interval and options mirrorInterval: "8h", // Default value, could be made configurable @@ -68,7 +71,7 @@ export function mapUiToDbConfig( // Visibility settings visibility: giteaConfig.visibility || "default", - preserveVisibility: giteaConfig.preserveOrgStructure, + preserveVisibility: false, // This should be a separate field, not the same as preserveOrgStructure // Organization creation createOrg: true, // Default to true diff --git a/src/lib/utils/mirror-strategies.ts b/src/lib/utils/mirror-strategies.ts index 4a525a2..c63e49d 100644 --- a/src/lib/utils/mirror-strategies.ts +++ b/src/lib/utils/mirror-strategies.ts @@ -2,7 +2,7 @@ * Mirror strategy configuration for handling various repository scenarios */ -export type NonMirrorStrategy = "skip" | "delete" | "rename" | "convert"; +export type NonMirrorStrategy = "skip" | "delete" | "rename"; export interface MirrorStrategyConfig { /** @@ -10,7 +10,7 @@ export interface MirrorStrategyConfig { * - "skip": Leave the repository as-is and mark as failed * - "delete": Delete the repository and recreate as mirror * - "rename": Rename the existing repository (not implemented yet) - * - "convert": Try to convert to mirror (not supported by most Gitea versions) + * Note: "convert" strategy was removed as it's not supported by most Gitea versions */ nonMirrorStrategy: NonMirrorStrategy; @@ -69,7 +69,7 @@ export function getMirrorStrategyConfig(): MirrorStrategyConfig { export function validateStrategyConfig(config: MirrorStrategyConfig): string[] { const errors: string[] = []; - if (!["skip", "delete", "rename", "convert"].includes(config.nonMirrorStrategy)) { + if (!["skip", "delete", "rename"].includes(config.nonMirrorStrategy)) { errors.push(`Invalid nonMirrorStrategy: ${config.nonMirrorStrategy}`); } diff --git a/src/pages/api/cleanup/trigger.ts b/src/pages/api/cleanup/trigger.ts index 630f274..55ac22f 100644 --- a/src/pages/api/cleanup/trigger.ts +++ b/src/pages/api/cleanup/trigger.ts @@ -49,7 +49,7 @@ export const POST: APIRoute = async ({ request }) => { ); } catch (error) { console.error('[Cleanup API] Error during manual cleanup:', error); - return createSecureErrorResponse(error); + return createSecureErrorResponse(error, 'manual cleanup', 500); } }; @@ -125,6 +125,6 @@ export const GET: APIRoute = async ({ request }) => { ); } catch (error) { console.error('[Cleanup API] Error getting cleanup status:', error); - return createSecureErrorResponse(error); + return createSecureErrorResponse(error, 'cleanup status', 500); } }; \ No newline at end of file