Refactor API files to provide mock implementations for analytics, auth, collections, ratings, scripts, and users, streamlining the codebase for frontend-only functionality. Remove legacy database schema and browser compatibility files to enhance clarity and maintainability.

This commit is contained in:
2025-08-16 00:22:56 +01:00
parent a96df855f5
commit d6f5901fe2
23 changed files with 2349 additions and 1845 deletions

View File

@ -0,0 +1,26 @@
import { drizzle } from 'drizzle-orm/mysql2';
import mysql from 'mysql2/promise';
import * as schema from './schema';
// Create the connection pool
const connection = await mysql.createConnection({
uri: process.env.DATABASE_URL!,
});
// Create the drizzle database instance
export const db = drizzle(connection, { schema, mode: 'default' });
// Export the schema for use in other parts of the app
export * from './schema';
// Test the connection
export const testConnection = async () => {
try {
await connection.ping();
console.log('✅ Database connection successful');
return true;
} catch (error) {
console.error('❌ Database connection failed:', error);
return false;
}
};