- Marked tasks in `TODO.md` as completed for moving task-related files to the `task-management` directory and correcting imports across the codebase. - Updated imports in `seed-data.ts`, `seed-tags.ts`, API routes, and various components to reflect the new structure. - Removed obsolete `daily.ts`, `tags.ts`, and `tasks.ts` files to streamline the codebase. - Added new tasks in `TODO.md` for future cleaning and organization of service imports.
30 lines
1.0 KiB
TypeScript
30 lines
1.0 KiB
TypeScript
import { NextRequest, NextResponse } from 'next/server';
|
|
import { dailyService } from '@/services/task-management/daily';
|
|
import { DailyCheckboxType } from '@/lib/types';
|
|
|
|
export async function GET(request: NextRequest) {
|
|
try {
|
|
const { searchParams } = new URL(request.url);
|
|
|
|
const maxDays = searchParams.get('maxDays') ? parseInt(searchParams.get('maxDays')!) : undefined;
|
|
const excludeToday = searchParams.get('excludeToday') === 'true';
|
|
const type = searchParams.get('type') as DailyCheckboxType | undefined;
|
|
const limit = searchParams.get('limit') ? parseInt(searchParams.get('limit')!) : undefined;
|
|
|
|
const pendingCheckboxes = await dailyService.getPendingCheckboxes({
|
|
maxDays,
|
|
excludeToday,
|
|
type,
|
|
limit
|
|
});
|
|
|
|
return NextResponse.json(pendingCheckboxes);
|
|
} catch (error) {
|
|
console.error('Error fetching pending checkboxes:', error);
|
|
return NextResponse.json(
|
|
{ error: 'Failed to fetch pending checkboxes' },
|
|
{ status: 500 }
|
|
);
|
|
}
|
|
}
|