Files
klz-cables.com/.pnpm-store/v10/files/84/7306ee48e12dc908115aa1c5a812215411a178396911aee83fbd4e0fc193e372232de2b0d5a1769da4347eec2261c3950659b50fc3214d78138bac9df19343
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

31 lines
1.1 KiB
Plaintext

import { status as httpStatus } from 'http-status';
import { restoreVersionOperationGlobal, sanitizePopulateParam } from '../../index.js';
import { getRequestGlobal } from '../../utilities/getRequestEntity.js';
import { headersWithCors } from '../../utilities/headersWithCors.js';
import { isNumber } from '../../utilities/isNumber.js';
export const restoreVersionHandler = async (req)=>{
const globalConfig = getRequestGlobal(req);
const { searchParams } = req;
const depth = searchParams.get('depth');
const draft = searchParams.get('draft');
const doc = await restoreVersionOperationGlobal({
id: req.routeParams.id,
depth: isNumber(depth) ? Number(depth) : undefined,
draft: draft === 'true' ? true : undefined,
globalConfig,
populate: sanitizePopulateParam(req.query.populate),
req
});
return Response.json({
doc,
message: req.t('version:restoredSuccessfully')
}, {
headers: headersWithCors({
headers: new Headers(),
req
}),
status: httpStatus.OK
});
};
//# sourceMappingURL=restoreVersion.js.map