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