1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { createUser, getUserByEmail } from "../database/queries.ts";
3import { sign } from "https://esm.sh/jsonwebtoken@9.0.2";
4import { compare, hash } from "https://esm.sh/bcrypt@5.1.1";
1import { createPayment, updateOrderStatus } from "../database/queries.ts";
2import { OrderStatus, PaymentResponse } from "../../shared/types.ts";
3
24 const transactionId = `txn_${Date.now()}_${Math.floor(Math.random() * 1000000)}`;
25
26 // Record the payment in the database
27 await createPayment(
28 orderId,
52// Get available payment methods
53export function getPaymentMethods() {
54 // In a real application, this might come from a database or payment gateway API
55 return [
56 { id: "credit_card", name: "Credit Card" },
1import { Context, Next } from "https://esm.sh/hono@3.11.7";
2import { getUserById } from "../database/queries.ts";
3import { verify } from "https://esm.sh/jsonwebtoken@9.0.2";
4
19 const decoded = verify(token, jwtSecret) as { userId: number };
20
21 // Get the user from the database
22 const user = await getUserById(decoded.userId);
23
32
33- **Framework**: Hono (TypeScript)
34- **Database**: SQLite
35- **Authentication**: JWT
36- **Payment Processing**: Stripe API integration
40```
41โโโ backend/
42โ โโโ database/
43โ โ โโโ migrations.ts # Schema definitions
44โ โ โโโ queries.ts # DB query functions
2import { cors } from "https://esm.sh/hono@3.11.7/middleware";
3import { readFile, serveFile } from "https://esm.town/v/std/utils/index.ts";
4import { runMigrations } from "./database/migrations.ts";
5import {
6 createJobPosting,
9 createChatMessage,
10 getChatMessages
11} from "./database/queries.ts";
12import { parseProject } from "https://esm.town/v/std/utils/index.ts";
13
65}
66
67// Helper functions to map database rows to TypeScript types
68function mapJobRow(row: any): JobPosting {
69 return {
2import { cors } from "https://esm.sh/hono@3.11.7/cors";
3import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
4import { runMigrations } from "./database/migrations.ts";
5import authRoutes from "./routes/auth.ts";
6import eventRoutes from "./routes/events.ts";
7import registrationRoutes from "./routes/registrations.ts";
8
9// Initialize database
10await runMigrations();
11
7 getEventById,
8 isUserRegistered
9} from "../database/queries.ts";
10import { jwtMiddleware } from "./auth.ts";
11import { ApiResponse, Registration } from "../../shared/types.ts";
8 getEventRegistrations,
9 isUserRegistered
10} from "../database/queries.ts";
11import { jwtMiddleware } from "./auth.ts";
12import {
2import { jwt } from "https://esm.sh/hono@3.11.7/jwt";
3import * as bcrypt from "https://esm.sh/bcrypt@5.1.1";
4import { createUser, getUserByEmail } from "../database/queries.ts";
5import { LoginRequest, RegisterRequest, AuthResponse, ApiResponse } from "../../shared/types.ts";
6import { sanitizeUser, isValidEmail, isEmptyString } from "../../shared/utils.ts";