From 0ae4346b0f82a1f407b92329dc6a40a6af0e3588 Mon Sep 17 00:00:00 2001 From: azdak Date: Sun, 24 Nov 2024 18:19:42 -0600 Subject: [PATCH] Added interface for UrlToScan input --- src/routes/addScansByPage.ts | 4 ++-- src/utils/interfaces.ts | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/routes/addScansByPage.ts b/src/routes/addScansByPage.ts index 66b694d..b10b7ac 100644 --- a/src/routes/addScansByPage.ts +++ b/src/routes/addScansByPage.ts @@ -1,4 +1,4 @@ -import { ScanResponse, ScanResponseJob } from "#src/utils/interfaces"; +import { ScanResponse, ScanResponseJob, UrlForScan } from "#src/utils/interfaces"; import { formatId, validateDiscovery, @@ -31,7 +31,7 @@ export const addScansByPage = async ({ request, reply }) => { message: "An array of URLs to send is required." }; } else { - for (const urlObj of request.body.urls) { + for (const urlObj of request.body.urls as Array) { if (!validateUrl(urlObj.url)) { return { status: "error", diff --git a/src/utils/interfaces.ts b/src/utils/interfaces.ts index 1ee875c..989b4c4 100644 --- a/src/utils/interfaces.ts +++ b/src/utils/interfaces.ts @@ -3,6 +3,11 @@ export interface ScanResponseJob { url: string; } +export interface UrlForScan { + url: string; + urlId: string; +} + export interface ScanResponse { jobs: Array; messages: Array;