feat: initial NFC Attendance Hub implementation
- 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
This commit is contained in:
17
app/api/queue/process/route.ts
Normal file
17
app/api/queue/process/route.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { NextRequest, NextResponse } from 'next/server'
|
||||
import { processQueue } from '@/lib/queue-processor'
|
||||
|
||||
export async function POST(req: NextRequest) {
|
||||
const internalKey = req.headers.get('x-internal-key')
|
||||
if (internalKey !== (process.env.INTERNAL_API_KEY || '')) {
|
||||
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })
|
||||
}
|
||||
|
||||
try {
|
||||
const result = await processQueue()
|
||||
return NextResponse.json({ success: true, ...result })
|
||||
} catch (err: any) {
|
||||
console.error('[Queue Process]', err)
|
||||
return NextResponse.json({ error: 'Processing failed' }, { status: 500 })
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user