17 lines
502 B
TypeScript
17 lines
502 B
TypeScript
|
|
import { NextResponse } from 'next/server';
|
||
|
|
|
||
|
|
import { withAuth, withPermission } from '@/lib/api/helpers';
|
||
|
|
import { getOverdueReminders } from '@/lib/services/reminders.service';
|
||
|
|
import { errorResponse } from '@/lib/errors';
|
||
|
|
|
||
|
|
export const GET = withAuth(
|
||
|
|
withPermission('reminders', 'view_all', async (_req, ctx) => {
|
||
|
|
try {
|
||
|
|
const data = await getOverdueReminders(ctx.portId);
|
||
|
|
return NextResponse.json({ data });
|
||
|
|
} catch (error) {
|
||
|
|
return errorResponse(error);
|
||
|
|
}
|
||
|
|
}),
|
||
|
|
);
|