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

+11 -7
View File
@@ -1,7 +1,11 @@
import { NextResponse } from "next/server";
import { getSongById, updateSong, deleteSong } from "@/lib/db/song";
// import { parseInt } from "@/lib/helper/checkvar";
interface RouteParams {
params: Promise<{
songId: string;
}>;
};
/**
* @openapi
@@ -27,10 +31,10 @@ import { getSongById, updateSong, deleteSong } from "@/lib/db/song";
* 500:
* description: Serverfehler
*/
export async function GET(request: Request, { params }) {
export async function GET(_request: Request, { params }: RouteParams) {
try {
const { songId } = await params;
const res = await getSongById(songId);
const res = await getSongById(parseInt(songId));
if (!res.success) {
return NextResponse.json({ message: res.error }, { status: res.status });
@@ -77,11 +81,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 { songId } = await params;
const data = await request.json();
const res = await updateSong(songId, data);
const res = await updateSong(parseInt(songId), data);
if (!res.success) {
return NextResponse.json({ message: res.error }, { status: res.status });
@@ -122,10 +126,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 { songId } = await params;
const res = await deleteSong(songId);
const res = await deleteSong(parseInt(songId));
if (!res.success) {
return NextResponse.json({ message: res.error }, { status: res.status });