EverydayTech Platform - Developer Reference
Complete Source Code Documentation - All Applications
Loading...
Searching...
No Matches
route.ts
Go to the documentation of this file.
1import { NextRequest, NextResponse } from 'next/server';
2import { fieldpineServerApi } from '@/lib/server/fieldpineApi';
3import { getStoredAuth } from '@/lib/server/auth';
4
5/**
6 * OpenAPI Stock2 Count by Key Endpoint
7 * DELETE /api/v1/openapi/stock2/count/[key] - Delete stock count record
8 */
9export async function DELETE(
10 request: NextRequest,
11 { params }: { params: Promise<{ key: string }> }
12) {
13 try {
14 const { key } = await params;
15 const authData = await getStoredAuth();
16 if (!authData || !authData.authenticated) {
17 return NextResponse.json(
18 { error: 'Authentication required' },
19 { status: 401 }
20 );
21 }
22
23 const result = await fieldpineServerApi.apiCall(
24 `/Stock2/Count/${key}`,
25 {
26 method: 'DELETE',
27 cookie: authData.apiKey,
28 useOpenApi: true
29 }
30 );
31
32 return NextResponse.json({
33 success: true,
34 data: result,
35 source: 'openapi'
36 });
37
38 } catch (error) {
39 console.error('Stock2 Count DELETE error:', error);
40 return NextResponse.json(
41 { error: 'Failed to delete stock count' },
42 { status: 500 }
43 );
44 }
45}