Round 13: PWA Offline Mode, Rate Limiting, Behavior Analytics, Interventions, Audit Logging

This commit is contained in:
Mustafa Cetin committed 2026-07-29 10:23:50 +00:00
1 parent ceea8fb591
commit ff4dd670d4
33 files changed
+6327 -509

No files matched your search

+3 -2
View File
@@ -1,6 +1,7 @@
import { NextResponse } from 'next/server';
import { db } from '@/lib/db';
import { getSession } from '@/lib/auth';
import { withRateLimit } from '@/lib/rate-limit';
function escapeCsvField(field: string | number | null | undefined): string {
if (field === null || field === undefined) return '';
@@ -59,7 +60,7 @@ function parseCsv(text: string): { headers: string[]; rows: ImportRow[] } {
return { headers, rows };
}
export async function POST(request: Request) {
export const POST = withRateLimit(async function POST(request: Request) {
try {
const session = await getSession();
if (!session) {
@@ -217,7 +218,7 @@ export async function POST(request: Request) {
console.error('Data Import error:', error);
return NextResponse.json({ error: 'Internal server error' }, { status: 500 });
}
}
}, 'heavy');
export async function GET(request: Request) {
try {