1import { NextRequest, NextResponse } from 'next/server';
2import { fieldpineServerApi } from '@/lib/server/fieldpineApi';
3import { getStoredAuth } from '@/lib/server/auth';
5export async function GET(request: NextRequest) {
7 const authData = await getStoredAuth();
8 if (!authData || !authData.authenticated) {
9 return NextResponse.json(
10 { error: 'Authentication required' },
16 const buckParams: Record<string, string> = {
17 "3": "retailmax.elink.staff.rights.list",
20 const rights = await fieldpineServerApi.buckApiCall(buckParams, authData.apiKey);
22 return NextResponse.json({
29 console.error('eLink staff rights error:', error);
30 return NextResponse.json(
31 { error: 'eLink endpoint unavailable', source: 'elink' },
37 console.error('eLink staff rights error:', error);
38 return NextResponse.json(
39 { error: 'Failed to fetch staff rights' },