Towniequeries.tsx1 match
6const PRICE_MULTIPLIER = 1.5;
78// Eventually we'll have a user database,
9// but in the meantime, we can cache user info in memory
10const userIdCache: { [key: string]: any } = {};
Towniepurchase-credits.ts1 match
1import { Hono } from "npm:hono";
2import Stripe from "npm:stripe";
3import { getUser } from "../database/queries.tsx";
4import { getEnvVarName } from "../../shared/is-prod-branch.ts";
5
Townie.cursorrules2 matches
198```
199βββ backend/
200β βββ database/
201β β βββ migrations.ts # Schema definitions
202β β βββ queries.ts # DB query functions
257```
258259### Database Patterns
260- Run migrations on startup or comment out for performance
261- Change table names when modifying schemas rather than altering
Towniecredit-balance.ts1 match
1import { Hono } from "npm:hono";
2import { getUser, getCreditBalance } from "../database/queries.tsx";
34const app = new Hono();
TownieBRANCH-TODO.md5 matches
14**Goal**: Replace limit checking with credit checking
1516**Database Changes:**
1718* AddedΒ credit\_additionsΒ table with indexes for performance
21
2223**New Functions inΒ /backend/database/queries.tsx:**
2425* getCreditBalance(userId)Β - calculates balance with 50% markup on usage
145--------------------------
146147**Database Schema:**
148149Plain textANTLR4BashCC#CSSCoffeeScriptCMakeDartDjangoDockerEJSErlangGitGoGraphQLGroovyHTMLJavaJavaScriptJSONJSXKotlinLaTeXLessLuaMakefileMarkdownMATLABMarkupObjective-CPerlPHPPowerShell.propertiesProtocol BuffersPythonRRubySass (Sass)Sass (Scss)SchemeSQLShellSwiftSVGTSXTypeScriptWebAssemblyYAMLXML` credit_additions ( id, user_id, created_at, stripe_payment_intent_id, amount, note ) -- Indexes on user_id for both credit_additions and townie_usage `
169**Backend:**
170171* backend/database/schema.tsxΒ - Added credit\_additions table
172
173* backend/database/queries.tsxΒ - New credit functions, removed old limits
174
175* backend/routes/send-message.tsΒ - Updated to use credit checking
untitled-9078main.tsx1 match
62Frontend & ReactJS \\
63Backend & Flask (Python) \\
64Database & MongoDB / Firebase \\
65NLP API & OpenAI GPT \\
66Styling & TailwindCSS / Bootstrap \\
EEPPortalnewsArticle.tsx1 match
513try {
514// **REMOVED: newId = crypto.randomUUID();**
515// The database will auto-increment the ID.
516const response = await fetch("/submit-news", {
517method: "POST",
Towniequeries.tsx1 match
6const PRICE_MULTIPLIER = 1.5;
78// Eventually we'll have a user database,
9// but in the meantime, we can cache user info in memory
10const userIdCache: { [key: string]: any } = {};
TownieTokenGeneratorTerminal.tsx15 matches
516await animateProgress('Asset transfer protocol', 2000);
517
518addLog('info', 'Synchronizing civic databases with Val.Town');
519await animateProgress('Database synchronization', 1500);
520
521// Generate massive token haul
759
760const checks = [
761{ name: 'Database connectivity', delay: 800 },
762{ name: 'Token integrity verification', delay: 1200 },
763{ name: 'Cryptographic hash validation', delay: 1000 },
781addLog('info', 'ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ');
782addLog('info', `π Status: ${healthData.status.toUpperCase()}`);
783addLog('info', `ποΈ Database: ${healthData.database}`);
784addLog('info', `π·οΈ Total tokens: ${healthData.total_tokens}`);
785addLog('info', `β° Timestamp: ${new Date(healthData.timestamp).toLocaleString()}`);
854};
855856const resetDatabase = async () => {
857if (state.isRunning) return;
858
859// Confirmation dialog
860if (!confirm('β οΈ WARNING: This will permanently delete ALL tokens from the database. This action cannot be undone. Are you sure you want to proceed?')) {
861return;
862}
867addLog('info', '');
868addLog('error', 'ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ');
869addLog('error', 'β β οΈ DATABASE RESET β');
870addLog('error', 'ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ');
871addLog('info', '');
872
873addLog('warning', 'π¨ DANGER ZONE: Initiating database reset...');
874await sleep(1000);
875
876addLog('info', 'π Acquiring exclusive database lock...');
877await animateProgress('Database lock', 1000);
878addLog('success', 'β Database locked for maintenance');
879
880addLog('info', 'ποΈ Purging token records...');
888
889if (result.success) {
890addLog('success', 'β Database reset completed');
891addLog('info', 'ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ');
892addLog('warning', `ποΈ ${result.message}`);
893addLog('info', 'π Database is now in pristine state');
894addLog('info', 'ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ');
895
897onTokenCountUpdate(0);
898} else {
899addLog('error', 'β Database reset failed');
900}
901
1003<button
1004className="control-button reset"
1005onClick={resetDatabase}
1006disabled={state.isRunning}
1007>
TownieTokenGeneratorindex.ts8 matches
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 {
5createToken,
10getRecentLogs,
11clearAllTokens
12} from "./database/queries.ts";
1314const app = new Hono();
19});
2021// Initialize database on startup
22await runMigrations();
23116});
117118// Clear all tokens (reset database)
119app.delete("/api/tokens", async c => {
120const deletedCount = await clearAllTokens();
121await logTerminalEntry('warning', `Database reset: ${deletedCount} tokens cleared`, 'system');
122
123return c.json({
124success: true,
125message: `Cleared ${deletedCount} tokens from database`
126});
127});
138heist_method: "Municipal Override Key",
139status: "SUCCESSFUL",
140vault_location: "Secure Civic Database",
141warning: "Civic authorities have been notified"
142};
164status: 'healthy',
165timestamp: new Date().toISOString(),
166database: 'connected',
167total_tokens: stats.total_tokens
168});