From 2cd6f4b171c52e9a253740efe37ff10dd30ec45d Mon Sep 17 00:00:00 2001 From: Segi Date: Sun, 30 Jun 2024 15:49:50 -0700 Subject: [PATCH] debugging code --- src/app/api/GetWatchListSources/route.tsx | 8 +++++--- src/app/api/GetWatchListTypes/route.tsx | 5 ++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/app/api/GetWatchListSources/route.tsx b/src/app/api/GetWatchListSources/route.tsx index 4d1652e..af317c8 100644 --- a/src/app/api/GetWatchListSources/route.tsx +++ b/src/app/api/GetWatchListSources/route.tsx @@ -15,10 +15,11 @@ import { defaultSources, execSelect, watchListSourcesSQL } from "../lib"; export async function GET() { const SQL="SELECT * FROM WatchListSources ORDER BY WatchListSourceName ASC"; - + console.log("Getting sources with the SQL " + SQL); try { const results = await execSelect(SQL, []); + console.log("Sources Results" + JSON.stringify(results)); return Response.json(["OK", results]); } catch (e) { try { @@ -26,14 +27,15 @@ export async function GET() { defaultSources.forEach(async (element) => { const SQL = "INSERT INTO WatchListSources (WatchListSourceName) VALUES (?)"; - + console.log("Adding default source with the SQL " + SQL); await execSelect(SQL, [element]); }); const results = await execSelect(SQL, []); - + console.log("Default Sources Results" + JSON.stringify(results))l return Response.json(["OK", results]); } catch(e) { + console.log("Error Sources Results" + e.message); return Response.json(["ERROR", `/GetWatchListSources: The error ${e.message} occurred getting the WatchList Sources`]); } } diff --git a/src/app/api/GetWatchListTypes/route.tsx b/src/app/api/GetWatchListTypes/route.tsx index ea54291..a5f2b4e 100644 --- a/src/app/api/GetWatchListTypes/route.tsx +++ b/src/app/api/GetWatchListTypes/route.tsx @@ -15,12 +15,15 @@ import { execSelect } from "../lib"; */ export async function GET(request: NextRequest) { const SQL="SELECT * FROM WatchListTypes ORDER BY WatchListTypeName ASC"; + + console.log("Getting types with the SQL " + SQL); try { const results = await execSelect(SQL, []); - + console.log("Types Results" + JSON.stringify(results)); return Response.json(["OK", results]); } catch (e) { + console.log("Error Types Results" + e.message); return Response.json(["ERROR", `/GetWatchListTypes: The error ${e.message} occurred getting the WatchList Types`]); } } \ No newline at end of file