- Multi-tenant client management with unique API keys - Semaphore SMS integration (per-client key + sender name + credit balance) - DB-based SMS queue with 3-attempt retry and exponential backoff - Failed SMS dashboard with manual retry button - Reports page with date/client filter and CSV export - Admin auth via NextAuth (email/password) - Docker Compose setup (app + PostgreSQL 16) - Prisma 5 schema with SmsQueue, SmsLog, Client, User models Tech: Next.js 14 App Router + TypeScript + Tailwind CSS + Prisma + PostgreSQL
26 lines
819 B
Bash
Executable File
26 lines
819 B
Bash
Executable File
#!/bin/sh
|
|
set -e
|
|
|
|
echo "🚀 Running database migrations..."
|
|
npx prisma migrate deploy || npx prisma db push --accept-data-loss
|
|
|
|
echo "🌱 Seeding initial data..."
|
|
node -e "
|
|
const { PrismaClient } = require('@prisma/client');
|
|
const bcrypt = require('bcryptjs');
|
|
const prisma = new PrismaClient();
|
|
async function seed() {
|
|
const email = process.env.SEED_EMAIL || 'admin@nfchub.local';
|
|
const pass = process.env.SEED_PASSWORD || 'admin123';
|
|
const existing = await prisma.user.findUnique({ where: { email } });
|
|
if (!existing) {
|
|
const hashed = await bcrypt.hash(pass, 12);
|
|
await prisma.user.create({ data: { email, password: hashed, name: 'Admin', role: 'ADMIN' } });
|
|
console.log('Admin user created:', email);
|
|
}
|
|
}
|
|
seed().catch(console.error).finally(() => prisma.\$disconnect());
|
|
" || true
|
|
|
|
exec "$@"
|