Skip to content

Commit

Permalink
debugging code
Browse files Browse the repository at this point in the history
  • Loading branch information
SegiH committed Jun 30, 2024
1 parent 8be1882 commit 2cd6f4b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/app/api/GetWatchListSources/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,27 @@ 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 {
await execSelect(watchListSourcesSQL, []);

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`]);
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/app/api/GetWatchListTypes/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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`]);
}
}

0 comments on commit 2cd6f4b

Please sign in to comment.