26| **Backend** | Node.js with Express/Koa, GraphQL API for efficient data queries. |
27| **Blockchain** | Ethereum (ERC-20) smart contracts in Solidity for deposits and rewards; Tron for TRC-20 withdrawals. |
28| **Database** | PostgreSQL or MongoDB for user data and mining stats. |
29| **Market Data API** | CoinGecko API or CoinMarketCap API for live crypto prices. |
30| **Mining Pool Backend** | Fork and customize [node-open-mining-portal](https://github.com/Multicoin-co/node-open-mining-portal). |
6});
7
8export async function getDatabase(databaseId: string) {
9 try {
10 const database = await notion.databases.retrieve({
11 database_id: databaseId,
12 });
13 return database;
14 } catch (error: any) {
15 return {
1import { Hono } from "npm:hono";
2import { getDatabase } from "../../controllers/database.controller.ts";
3
4const app = new Hono();
9 // hit the controller to return data
10 try {
11 const data = await getDatabase(id);
12 // console.log(data);
13 return c.json(data);
8export async function getDemosToCache() {
9 try {
10 const pages = await notion.databases.query({
11 database_id: Deno.env.get("GLANCE_DEMOS_DB_ID"),
12 filter: {
13 // only get active demos; we don't need to hit Notion for stale demos
30- [ ] add triggers to sidebar
31- [ ] add upload from SQL, CSV and JSON
32- [ ] add ability to connect to a non-val town Turso database
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
51}
52
53// Database setup
54const VOTES_TABLE = 'kuadratic_votes_1';
55const OPTIONS_TABLE = 'kuadratic_options_1';
56
57// DEFINE SCHEMa for VOTES_TABLE using zod
58async function initDatabase() {
59 await sqlite.execute(`CREATE TABLE IF NOT EXISTS ${VOTES_TABLE} (
60 id INTEGER PRIMARY KEY AUTOINCREMENT,
74}
75
76// Database queries
77async function getVoteCount(pollId: string): Promise<number> {
78 const result = await sqlite.execute(
97 );
98
99 // Validate and transform database results using zod schema
100 return result.rows.map(row => {
101 const validatedRow = VoteOptionSchema.parse({
301}
302
303// Initialize database on startup
304if (Deno.env.get('KUADRATIC_INITDB') || false )
305 await initDatabase();
306
307// Export functions
39 if (!recipeId) {
40 console.error('Failed to get recipe ID from insert result:', recipeResult);
41 throw new Error('Failed to create recipe: no ID returned from database');
42 }
43
47 if (isNaN(numericRecipeId) || numericRecipeId <= 0) {
48 console.error('Recipe ID is not a valid number:', recipeId);
49 throw new Error('Failed to create recipe: invalid ID returned from database');
50 }
51
8 updateShoppingListName,
9 deleteShoppingList
10} from "../database/queries.ts";
11
12const app = new Hono();
1import { Hono } from "npm:hono";
2import { getDatabase } from "../../controllers/database.controller.ts";
3
4const app = new Hono();
9 // hit the controller to return data
10 try {
11 const data = await getDatabase(id);
12 // console.log(data);
13 return c.json(data);
8export async function getDemosToCache() {
9 try {
10 const pages = await notion.databases.query({
11 database_id: Deno.env.get("GLANCE_DEMOS_DB_ID"),
12 filter: {
13 // only get active demos; we don't need to hit Notion for stale demos