From 55d950d010b63c8249d96635334680bc8ad08b61 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Fri, 3 Nov 2023 21:23:31 -0400 Subject: [PATCH] vault backup: 2023-11-03 21:23:31 --- api.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/api.ts b/api.ts index d092fc9..2e3cfe4 100644 --- a/api.ts +++ b/api.ts @@ -32,7 +32,19 @@ await client.connect(); const query = await Deno.readTextFile("sql/get.pg.sql"); function apply_guidance(doc: any) { - return doc; + + if (doc["hist"]["chan.mold.v0ds.vers"] && Array.isArray(doc["hist"]["chan.mold.v0ds.vers"])) { + // Loop through each element in the 'chan.mold.v0ds.vers' array + for (const element of doc["hist"]["chan.mold.v0ds.vers"]) { + // Process each element - 'element' is of type SeasonData + console.log(element); // Replace with actual processing logic + } + } else { + // Handle the case where 'chan.mold.v0ds.vers' is not an array or doesn't exist + console.error("'chan.mold.v0ds.vers' is not an array or does not exist in the document."); + } + + return doc; } // Define a route to retrieve values from the database using parameters