chore: clean up code by removing trailing whitespace and ensuring consistent formatting across various files = prettier

This commit is contained in:
Julien Froidefond
2025-12-01 08:37:30 +01:00
parent 757b1b84ab
commit e715779de7
98 changed files with 5453 additions and 3126 deletions

View File

@@ -4,4 +4,3 @@ import { authOptions } from "@/lib/auth";
const handler = NextAuth(authOptions);
export { handler as GET, handler as POST };

View File

@@ -10,7 +10,7 @@ export async function POST(request: NextRequest) {
if (!session) {
return NextResponse.json(
{ success: false, error: "Non authentifié" },
{ status: 401 }
{ status: 401 },
);
}
@@ -20,23 +20,26 @@ export async function POST(request: NextRequest) {
if (!oldPassword || !newPassword) {
return NextResponse.json(
{ success: false, error: "Mot de passe requis" },
{ status: 400 }
{ status: 400 },
);
}
if (newPassword.length < 4) {
return NextResponse.json(
{ success: false, error: "Le mot de passe doit contenir au moins 4 caractères" },
{ status: 400 }
{
success: false,
error: "Le mot de passe doit contenir au moins 4 caractères",
},
{ status: 400 },
);
}
const result = await authService.changePassword(oldPassword, newPassword);
if (!result.success) {
return NextResponse.json(
{ success: false, error: result.error },
{ status: 400 }
{ status: 400 },
);
}
@@ -45,8 +48,7 @@ export async function POST(request: NextRequest) {
console.error("Error changing password:", error);
return NextResponse.json(
{ success: false, error: "Erreur lors du changement de mot de passe" },
{ status: 500 }
{ status: 500 },
);
}
}

View File

@@ -4,7 +4,7 @@ import { requireAuth } from "@/lib/auth-utils";
export async function POST(
request: NextRequest,
{ params }: { params: Promise<{ id: string }> | { id: string } }
{ params }: { params: Promise<{ id: string }> | { id: string } },
) {
const authError = await requireAuth();
if (authError) return authError;
@@ -15,9 +15,12 @@ export async function POST(
} catch (error) {
console.error("Error restoring backup:", error);
return NextResponse.json(
{ success: false, error: error instanceof Error ? error.message : "Failed to restore backup" },
{ status: 500 }
{
success: false,
error:
error instanceof Error ? error.message : "Failed to restore backup",
},
{ status: 500 },
);
}
}

View File

@@ -4,7 +4,7 @@ import { requireAuth } from "@/lib/auth-utils";
export async function DELETE(
request: NextRequest,
{ params }: { params: Promise<{ id: string }> | { id: string } }
{ params }: { params: Promise<{ id: string }> | { id: string } },
) {
const authError = await requireAuth();
if (authError) return authError;
@@ -15,9 +15,12 @@ export async function DELETE(
} catch (error) {
console.error("Error deleting backup:", error);
return NextResponse.json(
{ success: false, error: error instanceof Error ? error.message : "Failed to delete backup" },
{ status: 500 }
{
success: false,
error:
error instanceof Error ? error.message : "Failed to delete backup",
},
{ status: 500 },
);
}
}

View File

@@ -32,10 +32,12 @@ export async function POST(_request: NextRequest) {
return NextResponse.json(
{
success: false,
error: error instanceof Error ? error.message : "Failed to create automatic backup",
error:
error instanceof Error
? error.message
: "Failed to create automatic backup",
},
{ status: 500 }
{ status: 500 },
);
}
}

View File

@@ -13,7 +13,7 @@ export async function GET() {
console.error("Error fetching backups:", error);
return NextResponse.json(
{ success: false, error: "Failed to fetch backups" },
{ status: 500 }
{ status: 500 },
);
}
}
@@ -25,15 +25,18 @@ export async function POST(request: NextRequest) {
try {
const body = await request.json().catch(() => ({}));
const force = body.force === true; // Only allow force for manual backups
const backup = await backupService.createBackup(force);
return NextResponse.json({ success: true, data: backup });
} catch (error) {
console.error("Error creating backup:", error);
return NextResponse.json(
{ success: false, error: error instanceof Error ? error.message : "Failed to create backup" },
{ status: 500 }
{
success: false,
error:
error instanceof Error ? error.message : "Failed to create backup",
},
{ status: 500 },
);
}
}

View File

@@ -12,7 +12,7 @@ export async function GET() {
console.error("Error fetching backup settings:", error);
return NextResponse.json(
{ success: false, error: "Failed to fetch settings" },
{ status: 500 }
{ status: 500 },
);
}
}
@@ -29,8 +29,7 @@ export async function PUT(request: NextRequest) {
console.error("Error updating backup settings:", error);
return NextResponse.json(
{ success: false, error: "Failed to update settings" },
{ status: 500 }
{ status: 500 },
);
}
}

View File

@@ -27,5 +27,3 @@ export async function POST() {
);
}
}

View File

@@ -13,8 +13,7 @@ export async function POST() {
console.error("Error deduplicating transactions:", error);
return NextResponse.json(
{ error: "Failed to deduplicate transactions" },
{ status: 500 }
{ status: 500 },
);
}
}