1import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
2
3// Database schema for time-series event storage
4const EVENTS_TABLE = 'realtime_events_v1';
5const METRICS_TABLE = 'system_metrics_v1';
6const AGGREGATES_TABLE = 'event_aggregates_v1';
7
8export async function initializeDatabase() {
9 // Events table - optimized for time-series data
10 await sqlite.execute(`
73 `);
74
75 console.log("Database initialized successfully");
76}
77
5import { MetricsCollector } from "./monitoring/metricsCollector.ts";
6import { HealthChecker } from "./monitoring/healthChecker.ts";
7import { initializeDatabase } from "./storage/database.ts";
8
9const app = new Hono();
20const healthChecker = new HealthChecker(metricsCollector);
21
22// Initialize database on startup
23await initializeDatabase();
24
25// Start the stream processor
2import geminiRouter from "./routes/gemini.ts";
3import staticRouter from "./routes/static.ts";
4import { initDatabase, getHistoryItems, deleteHistoryItem, clearHistory } from "./database/queries.ts";
5
6const app = new Hono();
11});
12
13// Initialize database on startup
14try {
15 await initDatabase();
16 console.log('Database initialized successfully');
17} catch (error) {
18 console.error('Database initialization failed:', error);
19}
20
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import type { CodeRequest, CodeResponse, GeminiApiResponse } from "../../shared/types.ts";
3import { saveHistoryItem } from "../database/queries.ts";
4
5const geminiRouter = new Hono();
4const TABLE_NAME = 'gemini_code_assist_history_1';
5
6// Initialize database
7export async function initDatabase() {
8 await sqlite.execute(`CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (
9 id TEXT PRIMARY KEY,
36โ โ โโโ gemini.ts # Gemini API integration
37โ โ โโโ static.ts # Static file serving
38โ โโโ database/
39โ โโโ queries.ts # Database operations
40โโโ frontend/
41โ โโโ index.html # Main HTML template
6 getBillById,
7 updateBill
8} from "../database/queries.ts";
9import type { ApiResponse, Payment, PaymentFormData } from "../../shared/types.ts";
10
12 createCustomer,
13 updateCustomer
14} from "../database/queries.ts";
15import type { ApiResponse, Bill, BillFormData, Customer } from "../../shared/types.ts";
16
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { sign, verify } from "https://esm.sh/hono@3.11.7/jwt";
3import { getUserByEmail, createUser, getCustomerById } from "../database/queries.ts";
4import type { AuthResponse } from "../../shared/types.ts";
5
32 // Here you would typically:
33 // 1. Validate the form data
34 // 2. Save to database
35 // 3. Send email notification
36 // 4. Return success response