You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
878 B
TypeScript
28 lines
878 B
TypeScript
import type { MedusaRequest, MedusaResponse } from "@medusajs/medusa";
|
|
import { EntityManager } from "typeorm";
|
|
|
|
import OnboardingService from "../../../services/onboarding";
|
|
|
|
export async function GET(req: MedusaRequest, res: MedusaResponse) {
|
|
const onboardingService: OnboardingService =
|
|
req.scope.resolve("onboardingService");
|
|
|
|
const status = await onboardingService.retrieve();
|
|
|
|
res.status(200).json({ status });
|
|
}
|
|
|
|
export async function POST(req: MedusaRequest, res: MedusaResponse) {
|
|
const onboardingService: OnboardingService =
|
|
req.scope.resolve("onboardingService");
|
|
const manager: EntityManager = req.scope.resolve("manager");
|
|
|
|
const status = await manager.transaction(async (transactionManager) => {
|
|
return await onboardingService
|
|
.withTransaction(transactionManager)
|
|
.update(req.body);
|
|
});
|
|
|
|
res.status(200).json({ status });
|
|
}
|