- Created .gitignore to exclude sensitive files and directories. - Added API documentation in API_DOCUMENTATION.md. - Included deployment instructions in DEPLOYMENT.md. - Established project structure documentation in PROJECT_STRUCTURE.md. - Updated README.md with project status and team information. - Added recommendations and status tracking documents. - Introduced testing guidelines in TESTING.md. - Set up CI workflow in .github/workflows/ci.yml. - Created Dockerfile for backend and frontend setups. - Added various service and utility files for backend functionality. - Implemented frontend components and pages for user interface. - Included mobile app structure and services. - Established scripts for deployment across multiple chains.
68 lines
1.7 KiB
TypeScript
68 lines
1.7 KiB
TypeScript
/**
|
|
* Initialize database with default configurations
|
|
* Run with: npx ts-node scripts/init-db.ts
|
|
*/
|
|
|
|
import { PrismaClient } from '@prisma/client';
|
|
|
|
const prisma = new PrismaClient();
|
|
|
|
async function initDatabase() {
|
|
try {
|
|
console.log('=== Initializing Database ===\n');
|
|
|
|
// Create default system configs
|
|
const defaultConfigs = [
|
|
{
|
|
key: 'push_notification_provider',
|
|
value: 'firebase',
|
|
description: 'Default push notification provider',
|
|
category: 'notifications',
|
|
},
|
|
{
|
|
key: 'max_deployment_retries',
|
|
value: 3,
|
|
description: 'Maximum number of deployment retries',
|
|
category: 'deployment',
|
|
},
|
|
{
|
|
key: 'deployment_timeout',
|
|
value: 300000, // 5 minutes
|
|
description: 'Deployment timeout in milliseconds',
|
|
category: 'deployment',
|
|
},
|
|
{
|
|
key: 'audit_log_retention_days',
|
|
value: 90,
|
|
description: 'Number of days to retain audit logs',
|
|
category: 'logging',
|
|
},
|
|
{
|
|
key: 'rate_limit_requests_per_minute',
|
|
value: 100,
|
|
description: 'Default rate limit for API requests',
|
|
category: 'security',
|
|
},
|
|
];
|
|
|
|
for (const config of defaultConfigs) {
|
|
await prisma.systemConfig.upsert({
|
|
where: { key: config.key },
|
|
update: {},
|
|
create: config,
|
|
});
|
|
console.log(`✅ Created config: ${config.key}`);
|
|
}
|
|
|
|
console.log('\n✅ Database initialization complete!');
|
|
} catch (error: any) {
|
|
console.error('\n❌ Error initializing database:', error.message);
|
|
process.exit(1);
|
|
} finally {
|
|
await prisma.$disconnect();
|
|
}
|
|
}
|
|
|
|
initDatabase();
|
|
|