Skip to main content
Glama
route.ts1.42 kB
import { NextRequest, NextResponse } from 'next/server'; import { prisma } from '@/lib/db'; import { MindbodySyncService, SyncEntity } from '@/lib/sync'; // ============================================================================ // SYNC API ROUTE - Triggers data synchronization // ============================================================================ export async function POST(request: NextRequest) { try { const body = await request.json().catch(() => ({})); const entities = body.entities as SyncEntity[] | undefined; const syncService = new MindbodySyncService(prisma); const results = await syncService.syncAll({ entities }); return NextResponse.json({ success: true, results, timestamp: new Date().toISOString(), }); } catch (error: any) { console.error('Sync error:', error); return NextResponse.json( { success: false, error: error.message }, { status: 500 } ); } } export async function GET() { try { const syncService = new MindbodySyncService(prisma); const status = await syncService.getSyncStatus(); return NextResponse.json({ success: true, status, timestamp: new Date().toISOString(), }); } catch (error: any) { console.error('Sync status error:', error); return NextResponse.json( { success: false, error: error.message }, { status: 500 } ); } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/vespo92/MindbodyMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server