mirror of
https://github.com/RayLabsHQ/gitea-mirror.git
synced 2025-12-09 21:16:48 +03:00
More tsc issues
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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}`);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user