Working on Standartisation.... #TODO

This commit is contained in:
Rudi committed 2026-08-27 18:07:42 +02:00
1 parent da4d67ea47
commit bdc864cf94
8 files changed
+104 -36

No files matched your search

+12 -7
View File
@@ -1,6 +1,11 @@
import { NextResponse } from "next/server";
import { getSongBookById, updateSongBook, deleteSongBook } from "@/lib/db/songbook";
// import { parseInt } from "@/lib/helper/checkvar";
interface RouteParams {
params: Promise<{
songBookId: string;
}>;
};
/**
* @openapi
@@ -28,12 +33,12 @@ import { getSongBookById, updateSongBook, deleteSongBook } from "@/lib/db/songbo
*/
export async function GET(request: Request, { params }) {
export async function GET(_request: Request, { params }: RouteParams) {
try {
const { songBookId } = await params;
const res = await getSongBookById(songBookId);
const res = await getSongBookById(parseInt(songBookId));
if (!res.success) {
@@ -81,11 +86,11 @@ export async function GET(request: Request, { params }) {
* 500:
* description: Serverfehler
*/
export async function PATCH(request: Request, { params }) {
export async function PATCH(request: Request, { params }: RouteParams) {
try {
const { songBookId } = await params;
const data = await request.json();
const res = await updateSongBook(songBookId, data);
const res = await updateSongBook(parseInt(songBookId), data);
if (!res.success) {
return NextResponse.json({ message: res.error }, { status: res.status });
@@ -126,10 +131,10 @@ export async function PATCH(request: Request, { params }) {
* 500:
* description: Serverfehler
*/
export async function DELETE(request: Request, { params }) {
export async function DELETE(_request: Request, { params }: RouteParams) {
try {
const { songBookId } = await params;
const res = await deleteSongBook(songBookId);
const res = await deleteSongBook(parseInt(songBookId));
if (!res.success) {
return NextResponse.json({ message: res.error }, { status: res.status });