130 }
131
132 console.log(`Weather forecast updated in the database.`);
133 return summary;
134}
125 }
126
127 console.log(`Calendar events imported into the database.`);
128 return events;
129 } catch (error) {
8
9/**
10 * Retrieves previously generated fun facts from the memories database
11 * @returns Array of previous fun facts
12 */
47
48/**
49 * Inserts a fun fact into the memories database
50 * @param date Date for the fun fact in ISO format
51 * @param factText The fun fact text
208```
209โโโ backend/
210โ โโโ database/
211โ โ โโโ migrations.ts # Schema definitions
212โ โ โโโ queries.ts # DB query functions
270- Handle API calls properly with proper error catching
271
272### Database Patterns
273- Run migrations on startup or comment out for performance
274- Change table names when modifying schemas rather than altering
40 <li>We extract email domains from your user list</li>
41 <li>
42 We match these domains against our database of YC companies (sourced{" "}
43 <a href="https://docs.google.com/spreadsheets/d/181GQmXflgMCCI9awLbzK4Zf0uneQBKoh51wBjNTc8Us/edit?gid=0#gid=0">
44 here
45 </a>
46 , cached <a href="https://www.val.town/v/stevekrouse/yc_database">here</a>)
47 </li>
48 <li>You get a detailed report of matches, enriched with YC company data</li>
226
227export default async function server(request: Request): Promise<Response> {
228 const companies = await fetch("https://stevekrouse-yc_database.web.val.run").then(res => res.json());
229 const url = new URL(request.url);
230 if (url.pathname === "/companies.json") {
28
29/**
30 * Store a chat message in the database
31 */
32export async function storeChatMessage(
57 const link = `${UPSTREAM_PONDIVERSE_URL}/explore/#c${original_id}`;
58
59 // 6. Insert into Database (handles duplicates via UNIQUE constraint)
60 try {
61 await sqlite.execute({
83 return Response.json({ ok: true, id: original_id, status: "duplicate" }, { status: 200 });
84 } else {
85 console.error(`Database error storing creation ID ${original_id}:`, dbError);
86 return Response.json({ ok: false, error: "Database error" }, { status: 500 });
87 }
88 }
27 );
28
29 console.log(`Database table ${AGGREGATOR_TABLE_NAME} initialized.`);
30 return { ok: true };
31}
62 <guid>${siteUrl}#error-${Date.now()}</guid>
63 <pubDate>${new Date().toUTCString()}</pubDate>
64 <description>Could not retrieve items from the database.</description>
65 </item>`;
66 }
1// Script to set up the telegram_chats table in SQLite
2// Run this script manually to create the database table
3
4export default async function setupTelegramChatDb() {
25 `);
26
27 return "Telegram chat database table created successfully.";
28 } catch (error) {
29 console.error("Error setting up telegram_chats table:", error);