feat(MED-131): update analyses sync to medusa store

This commit is contained in:
2025-08-04 11:52:09 +03:00
parent b665678dbb
commit ee60a78335
8 changed files with 460 additions and 186 deletions

View File

@@ -0,0 +1,27 @@
import { NextRequest, NextResponse } from "next/server";
import loadEnv from "../handler/load-env";
import validateApiKey from "../handler/validate-api-key";
import syncAnalysisGroupsStore from "../handler/sync-analysis-groups-store";
export const GET = async (request: NextRequest) => {
loadEnv();
try {
validateApiKey(request);
} catch (e) {
return NextResponse.json({}, { status: 401, statusText: 'Unauthorized' });
}
try {
await syncAnalysisGroupsStore();
console.info("Successfully synced analysis groups store");
return NextResponse.json({
message: 'Successfully synced analysis groups store',
}, { status: 200 });
} catch (e) {
console.error("Error syncing analysis groups store", e);
return NextResponse.json({
message: 'Failed to sync analysis groups store',
}, { status: 500 });
}
};