🐛 Fix pull request issues

This commit is contained in:
Meier Lukas
2023-06-10 19:04:54 +02:00
parent d704dfa8b6
commit c1658d68e1
16 changed files with 115 additions and 77 deletions

View File

@@ -5,8 +5,9 @@ import Consola from 'consola';
import { NextApiRequest, NextApiResponse } from 'next';
import { z } from 'zod';
import { AppIntegrationType } from '../../../types/app';
import { AppIntegrationType, IntegrationType } from '../../../types/app';
import { getConfig } from '../../../tools/config/getConfig';
import { checkIntegrationsType } from '~/tools/client/app-properties';
export default async (req: NextApiRequest, res: NextApiResponse) => {
// Filter out if the reuqest is a POST or a GET
@@ -51,14 +52,14 @@ async function Get(req: NextApiRequest, res: NextApiResponse) {
const calendar = config.widgets.find((w) => w.type === 'calendar' && w.id === widgetId);
const useSonarrv4 = calendar?.properties.useSonarrv4 ?? false;
const mediaAppIntegrationTypes: AppIntegrationType['type'][] = [
const mediaAppIntegrationTypes = [
'sonarr',
'radarr',
'readarr',
'lidarr',
];
const mediaApps = config.apps.filter(
(app) => app.integration && mediaAppIntegrationTypes.includes(app.integration.type)
] as const satisfies readonly IntegrationType[];
const mediaApps = config.apps.filter((app) =>
checkIntegrationsType(app.integration, mediaAppIntegrationTypes)
);
const IntegrationTypeEndpointMap = new Map<AppIntegrationType['type'], string>([