x
This commit is contained in:
1 parent
81ed9af406
commit
4536db6741
56 files changed
+1127
-198
No files matched your search
@@ -0,0 +1,53 @@
|
||||
import prisma from '../src/lib/prisma';
|
||||
import crypto from 'crypto';
|
||||
async function main() {
|
||||
const menu = await prisma.menu.findUnique({
|
||||
where: { name: 'main' }
|
||||
});
|
||||
if (!menu || !menu.payload) {
|
||||
console.error('Menu main not found or payload is empty');
|
||||
return;
|
||||
}
|
||||
const payload = menu.payload;
|
||||
let updated = false;
|
||||
for (let i = 0; i < payload.length; i++) {
|
||||
const node = payload[i];
|
||||
if (node.nodeId === 'b4b2faf8-8881-4ca9-a8d5-a88054a37385') {
|
||||
if (node.links && !node.columns) {
|
||||
console.log('Fixing Scent Guide node...');
|
||||
const newColumn = {
|
||||
nodeId: crypto.randomUUID(),
|
||||
title: {
|
||||
en: 'Essential Oils',
|
||||
th: 'น้ำมันหอมระเหย',
|
||||
ja: 'エッセンシャルオイル',
|
||||
ko: '에센셜 오일',
|
||||
vi: 'Tinh dầu',
|
||||
zh: '精油'
|
||||
},
|
||||
links: node.links
|
||||
};
|
||||
node.columns = [newColumn];
|
||||
delete node.links;
|
||||
updated = true;
|
||||
}
|
||||
else {
|
||||
console.log('Scent Guide node already has columns or no links to fix.');
|
||||
}
|
||||
}
|
||||
}
|
||||
if (updated) {
|
||||
await prisma.menu.update({
|
||||
where: { name: 'main' },
|
||||
data: { payload }
|
||||
});
|
||||
console.log('Successfully updated main menu payload.');
|
||||
}
|
||||
else {
|
||||
console.log('No updates were necessary.');
|
||||
}
|
||||
}
|
||||
main()
|
||||
.catch(console.error)
|
||||
.finally(() => prisma.$disconnect());
|
||||
//# sourceMappingURL=fix-scent-guide.js.map
|
||||
Reference in new issue
Block a user