stevensDemogenerateFunFacts.ts2 matches
89/**
10* Retrieves previously generated fun facts from the memories database
11* @returns Array of previous fun facts
12*/
4748/**
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
stevensDemo.cursorrules2 matches
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
271272### Database Patterns
273- Run migrations on startup or comment out for performance
274- Change table names when modifying schemas rather than altering
promptfixerdatabase.ts5 matches
5const PROMPTS_TABLE = 'prompt_requests_v1';
67// Initialize database tables
8export async function initDatabase() {
9try {
10await sqlite.execute(`
20)
21`);
22console.log("Database initialized");
23} catch (error) {
24console.error("Database initialization error:", error);
25throw error;
26}
101}
102103// Helper function to map a database row to a PromptRequest object
104function mapRowToPromptRequest(row: any[], columns: string[]): PromptRequest {
105const result: Record<string, any> = {};
promptfixertypes.ts1 match
23}
2425// For database operations
26export interface SQLQueryResult {
27columns: string[];
promptfixerREADME.md4 matches
102. **Email Submission** - Users can email their prompt details, which are automatically parsed using Gemini AI.
1112All submissions are stored in a SQLite database and can be accessed through an admin panel where administrators can:
1314- View all prompt requests
20- `backend/` - Server-side code
21- `index.ts` - Main API server (Hono)
22- `database.ts` - SQLite database operations
23- `email-service.ts` - Email processing and sending
24- `email-handler.ts` - Email endpoint handler
43- View all submitted requests
44- Create and send improved prompts to users
45- **SQLite Database** for data storage
46- **Email Notifications**
47- To admins when new requests arrive
62- Val Town Platform
63- Hono (API framework)
64- SQLite (database)
65- OpenAI (for email processing)
66- TailwindCSS (styling)
ValTownForNotionindex.ts4 matches
10import exampleCallout from "./routes/exampleCallout.ts";
11import exampleChildPages from "./routes/exampleChildPages.ts";
12import exampleDatabasePage from "./routes/exampleDatabasePage.ts";
13import exampleDatabasePages from "./routes/exampleDatabasePages.ts";
14import home from "./routes/home.ts";
15import testRoutes from "./routes/testRoutes.ts";
27// Mount all route modules
28app.route("/", home);
29app.route("/", exampleDatabasePages);
30app.route("/", exampleDatabasePage);
31app.route("/", exampleChildPages);
32app.route("/", exampleCallout);
ValTownForNotionREADME.md2 matches
5## Route Files
67- `exampleDatabasePages.ts` - Handles `/example/database/pages` endpoint for resetting database pages
8- `exampleDatabasePage.ts` - Handles `/example/database/page` endpoint for updating a single database page
9- `exampleChildPages.ts` - Handles `/example/child_pages` endpoint for managing child pages
10- `exampleCallout.ts` - Handles `/example/callout` endpoint for updating callout blocks
5const app = new Hono();
67app.post("/example/database/page", async (c) => {
8const payload = await c.req.json();
9const data = await payload?.data;
1718// store webhook data in blob storage for resets
19// capture the database id to store in the blob
20const databaseId = data?.parent?.database_id;
21const blobObject = {
22id: databaseId,
23date: new Date(),
24content: askingFor,
ValTownForNotionexampleDatabasePages.ts11 matches
10const app = new Hono();
1112app.post("/example/database/pages", async (c) => {
13// blob keys map to endpoints for the cron resets
14const blobKey = await c.req.url.replace("https://", "");
15const askingFor = c.req.headers.get("asking_for") || "default"; // val.town or default
1617// capture the database id to store in the blob
18const targetId = c.req.headers.get("target_id");
1920// get the pages in this database
21const databaseChildren = await notion.databases.query({ database_id: targetId });
22// delete all pages to prevent bad actors from leaving naughty rows behi
23for (const [key, child] of databaseChildren.results.entries()) {
24const page = await notion.pages.update({
25page_id: child.id,
28}
2930// get the database
31const database = await notion.databases.retrieve({ database_id: targetId });
32// convert the statuses string in the status property into JSON
33const statuses = JSON.parse(database?.properties?.Statuses?.formula?.expression);
34// get the first item on the list of statuses, to set the status for new pages
35const status = statuses[0];
36// add back pages; fresh start for the next person to add favicons
37const defaults = ["val.town", "notion.com", "hono.dev"].reverse();
38// create new database pages from default object
39for (const item of defaults) {
40const page = await notion.pages.create({
41parent: {
42type: "database_id",
43database_id: targetId,
44},
45properties: {
stevensDemosetupTelegramChatDb.ts2 matches
1// Script to set up the telegram_chats table in SQLite
2// Run this script manually to create the database table
34export default async function setupTelegramChatDb() {
25`);
2627return "Telegram chat database table created successfully.";
28} catch (error) {
29console.error("Error setting up telegram_chats table:", error);