29 lines
738 B
TypeScript
29 lines
738 B
TypeScript
import { NextRequest, NextResponse } from 'next/server';
|
|
import { dailyService } from '@/services/task-management/daily';
|
|
|
|
export async function PATCH(
|
|
request: NextRequest,
|
|
{ params }: { params: Promise<{ id: string }> }
|
|
) {
|
|
try {
|
|
const { id: checkboxId } = await params;
|
|
|
|
if (!checkboxId) {
|
|
return NextResponse.json(
|
|
{ error: 'Checkbox ID is required' },
|
|
{ status: 400 }
|
|
);
|
|
}
|
|
|
|
const archivedCheckbox = await dailyService.archiveCheckbox(checkboxId);
|
|
|
|
return NextResponse.json(archivedCheckbox);
|
|
} catch (error) {
|
|
console.error('Error archiving checkbox:', error);
|
|
return NextResponse.json(
|
|
{ error: 'Failed to archive checkbox' },
|
|
{ status: 500 }
|
|
);
|
|
}
|
|
}
|