style: auto-fix linting issues

This commit is contained in:
EduardPrigoana 2026-02-11 06:51:52 +00:00 committed by github-actions[bot]
parent 35f1f7f7d1
commit 3a60e65f75
6 changed files with 24 additions and 14 deletions

View file

@ -4,7 +4,7 @@ import z from 'zod';
const downloadParamsSchema = z.object({
track_id: z.preprocess((a) => parseInt(a as string), z.number().min(0, 'ID must be 0 or greater').default(1)),
quality: z.enum(['27', '7', '6', '5']).default('27')
quality: z.enum(['27', '7', '6', '5']).default('27'),
});
export async function GET(request: NextRequest) {
@ -18,7 +18,7 @@ export async function GET(request: NextRequest) {
return new NextResponse(
JSON.stringify({
success: false,
error: error?.errors || error.message || 'An error occurred parsing the request.'
error: error?.errors || error.message || 'An error occurred parsing the request.',
}),
{ status: 400 }
);

View file

@ -3,7 +3,7 @@ import { getAlbumInfo } from '@/lib/qobuz-dl-server';
import z from 'zod';
const albumInfoParamsSchema = z.object({
album_id: z.string().min(1, 'ID is required')
album_id: z.string().min(1, 'ID is required'),
});
export async function GET(request: NextRequest) {
@ -17,7 +17,7 @@ export async function GET(request: NextRequest) {
return new NextResponse(
JSON.stringify({
success: false,
error: error?.errors || error.message || 'An error occurred parsing the request.'
error: error?.errors || error.message || 'An error occurred parsing the request.',
}),
{ status: 400 }
);

View file

@ -2,7 +2,7 @@ import { getArtist } from '@/lib/qobuz-dl-server';
import z from 'zod';
const artistReleasesParamsSchema = z.object({
artist_id: z.string().min(1, 'ID is required')
artist_id: z.string().min(1, 'ID is required'),
});
export async function GET(request: Request) {
@ -16,7 +16,7 @@ export async function GET(request: Request) {
return new Response(
JSON.stringify({
success: false,
error: error?.errors || error.message || 'An error occurred parsing the request.'
error: error?.errors || error.message || 'An error occurred parsing the request.',
}),
{ status: 400 }
);

View file

@ -6,7 +6,7 @@ export async function GET() {
return new NextResponse(
JSON.stringify({
success: false,
error: 'No countries list found'
error: 'No countries list found',
})
);
}
@ -15,14 +15,14 @@ export async function GET() {
return new NextResponse(
JSON.stringify({
success: true,
data: countryCodes
data: countryCodes,
})
);
} catch {
return new NextResponse(
JSON.stringify({
success: false,
error: 'Error parsing the countries list'
error: 'Error parsing the countries list',
})
);
}

View file

@ -4,7 +4,10 @@ import z from 'zod';
const searchParamsSchema = z.object({
q: z.string().min(1, 'Query is required'),
offset: z.preprocess((a) => parseInt(a as string), z.number().max(1000, 'Offset must be less than 1000').min(0, 'Offset must be 0 or greater').default(0))
offset: z.preprocess(
(a) => parseInt(a as string),
z.number().max(1000, 'Offset must be less than 1000').min(0, 'Offset must be 0 or greater').default(0)
),
});
export async function GET(request: NextRequest) {
@ -18,7 +21,7 @@ export async function GET(request: NextRequest) {
return new NextResponse(
JSON.stringify({
success: false,
error: error?.errors || error.message || 'An error occurred parsing the request.'
error: error?.errors || error.message || 'An error occurred parsing the request.',
}),
{ status: 400 }
);

View file

@ -7,7 +7,7 @@ const releasesParamsSchema = z.object({
release_type: z.enum(['album', 'live', 'compilation', 'epSingle', 'download']).default('album'),
track_size: z.number().positive().default(1000),
offset: z.preprocess((a) => parseInt(a as string), z.number().positive().default(0)),
limit: z.preprocess((a) => parseInt(a as string), z.number().positive().default(10))
limit: z.preprocess((a) => parseInt(a as string), z.number().positive().default(10)),
});
export async function GET(request: NextRequest) {
@ -15,13 +15,20 @@ export async function GET(request: NextRequest) {
const params = Object.fromEntries(new URL(request.url).searchParams.entries());
try {
const { artist_id, release_type, track_size, offset, limit } = releasesParamsSchema.parse(params);
const data = await getArtistReleases(artist_id, release_type, limit, offset, track_size, country ? { country } : {});
const data = await getArtistReleases(
artist_id,
release_type,
limit,
offset,
track_size,
country ? { country } : {}
);
return new NextResponse(JSON.stringify({ success: true, data }), { status: 200 });
} catch (error: any) {
return new NextResponse(
JSON.stringify({
success: false,
error: error?.errors || error.message || 'An error occurred parsing the request.'
error: error?.errors || error.message || 'An error occurred parsing the request.',
}),
{ status: 400 }
);