1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
3import { runMigrations } from "./database/migrations.ts";
4import api from "./routes/api.ts";
5
11});
12
13// Initialize database on startup
14await runMigrations();
15
10 getTaskSetById,
11 getTaskSetByUserAndDate,
12} from "../database/queries.ts";
13import { sendCompletionConfirmation } from "../services/emailService.ts";
14
1import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
2
3// Database schema for VA Task Tidy
4// Note: Change table names when modifying schemas
5
9
10export async function runMigrations() {
11 console.log('Running database migrations...');
12
13 // Users table
52 `);
53
54 console.log('Database migrations completed successfully');
55}
56
15```
16โโโ backend/
17โ โโโ database/
18โ โ โโโ migrations.ts # Database schema
19โ โ โโโ queries.ts # Database operations
20โ โโโ routes/
21โ โ โโโ api.ts # API endpoints
41## Setup
42
431. The app automatically creates the database on first run
442. Set up the cron jobs for automated reminders
453. Users can access the app to set tasks and view their progress
42 `);
43
44 console.log("Database migrations completed successfully");
45 } catch (error) {
46 console.error("Database migration error:", error);
47 // Don't throw the error to allow the app to start even if DB is temporarily unavailable
48 }
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
3import { runMigrations } from "./database/migrations.ts";
4import api from "./routes/api.ts";
5
11});
12
13// Initialize database
14await runMigrations();
15
2// Schedule: 0 9 * * * (9AM every day)
3
4import { runMigrations } from "../backend/database/migrations.ts";
5import {
6 getUsersNeedingMorningReminder,
7 getTasksForDate,
8 markReminderSent
9} from "../backend/database/queries.ts";
10import { sendMorningReminder } from "../backend/routes/email.ts";
11
14
15 try {
16 // Ensure database is initialized
17 await runMigrations();
18
2// Schedule: 0 20 * * * (8PM every day)
3
4import { runMigrations } from "../backend/database/migrations.ts";
5import {
6 getUsersNeedingEveningReminder,
7 getTodaysTasks
8} from "../backend/database/queries.ts";
9import { sendEveningReminder } from "../backend/routes/email.ts";
10
13
14 try {
15 // Ensure database is initialized
16 await runMigrations();
17
8 recordTaskCompletion,
9 getTasksForDate
10} from "../database/queries.ts";
11
12const api = new Hono();
22```
23โโโ backend/
24โ โโโ database/
25โ โ โโโ migrations.ts # Database schema
26โ โ โโโ queries.ts # Database operations
27โ โโโ routes/
28โ โ โโโ api.ts # API endpoints
45## Setup
46
471. The app will automatically create the necessary database tables
482. Set up the cron jobs for automated reminders (schedules need to be configured in Val Town UI)
493. Users can start adding their tasks immediately