1import { NextRequest, NextResponse } from 'next/server';
2import { fieldpineServerApi } from '@/lib/server/fieldpineApi';
3import { getStoredAuth } from '@/lib/server/auth';
6 * OpenAPI Stock2 Count by Key Endpoint
7 * DELETE /api/v1/openapi/stock2/count/[key] - Delete stock count record
9export async function DELETE(
11 { params }: { params: Promise<{ key: string }> }
14 const { key } = await params;
15 const authData = await getStoredAuth();
16 if (!authData || !authData.authenticated) {
17 return NextResponse.json(
18 { error: 'Authentication required' },
23 const result = await fieldpineServerApi.apiCall(
24 `/Stock2/Count/${key}`,
27 cookie: authData.apiKey,
32 return NextResponse.json({
39 console.error('Stock2 Count DELETE error:', error);
40 return NextResponse.json(
41 { error: 'Failed to delete stock count' },