More tsc issues

This commit is contained in:
Arunavo Ray
2025-08-28 08:34:41 +05:30
parent ad7418aef2
commit b3856b4223
3 changed files with 9 additions and 6 deletions

View File

@@ -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

View File

@@ -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}`);
}

View File

@@ -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);
}
};