refactor: standardize quotation marks across all files and improve code consistency

This commit is contained in:
Julien Froidefond
2025-11-27 11:40:30 +01:00
parent cc1e8c20a6
commit b2efade4d5
107 changed files with 9471 additions and 5952 deletions

View File

@@ -1,5 +1,5 @@
import { NextResponse } from "next/server"
import { prisma } from "@/lib/prisma"
import { NextResponse } from "next/server";
import { prisma } from "@/lib/prisma";
export async function POST() {
try {
@@ -10,15 +10,17 @@ export async function POST() {
data: {
categoryId: null,
},
})
});
return NextResponse.json({
success: true,
count: result.count,
})
});
} catch (error) {
console.error("Error clearing categories:", error)
return NextResponse.json({ error: "Failed to clear categories" }, { status: 500 })
console.error("Error clearing categories:", error);
return NextResponse.json(
{ error: "Failed to clear categories" },
{ status: 500 },
);
}
}

View File

@@ -1,42 +1,57 @@
import { NextResponse } from "next/server"
import { transactionService } from "@/services/transaction.service"
import type { Transaction } from "@/lib/types"
import { NextResponse } from "next/server";
import { transactionService } from "@/services/transaction.service";
import type { Transaction } from "@/lib/types";
export async function POST(request: Request) {
try {
const transactions: Transaction[] = await request.json()
const result = await transactionService.createMany(transactions)
return NextResponse.json(result)
const transactions: Transaction[] = await request.json();
const result = await transactionService.createMany(transactions);
return NextResponse.json(result);
} catch (error) {
console.error("Error creating transactions:", error)
return NextResponse.json({ error: "Failed to create transactions" }, { status: 500 })
console.error("Error creating transactions:", error);
return NextResponse.json(
{ error: "Failed to create transactions" },
{ status: 500 },
);
}
}
export async function PUT(request: Request) {
try {
const transaction: Transaction = await request.json()
const updated = await transactionService.update(transaction.id, transaction)
return NextResponse.json(updated)
const transaction: Transaction = await request.json();
const updated = await transactionService.update(
transaction.id,
transaction,
);
return NextResponse.json(updated);
} catch (error) {
console.error("Error updating transaction:", error)
return NextResponse.json({ error: "Failed to update transaction" }, { status: 500 })
console.error("Error updating transaction:", error);
return NextResponse.json(
{ error: "Failed to update transaction" },
{ status: 500 },
);
}
}
export async function DELETE(request: Request) {
try {
const { searchParams } = new URL(request.url)
const id = searchParams.get("id")
const { searchParams } = new URL(request.url);
const id = searchParams.get("id");
if (!id) {
return NextResponse.json({ error: "Transaction ID is required" }, { status: 400 })
return NextResponse.json(
{ error: "Transaction ID is required" },
{ status: 400 },
);
}
await transactionService.delete(id)
return NextResponse.json({ success: true })
await transactionService.delete(id);
return NextResponse.json({ success: true });
} catch (error) {
console.error("Error deleting transaction:", error)
return NextResponse.json({ error: "Failed to delete transaction" }, { status: 500 })
console.error("Error deleting transaction:", error);
return NextResponse.json(
{ error: "Failed to delete transaction" },
{ status: 500 },
);
}
}