Spaces:
Paused
Paused
Download server/scripts/check_db_mojibake.js from shanshal66/chinak2: direct link, hf CLI and curl.
- Browser
- Download file 1.34 kB
-
https://huggingface.co/spaces/shanshal66/chinak2/resolve/main/server/scripts/check_db_mojibake.js
- Command line
-
hf download hf://spaces/shanshal66/chinak2/server/scripts/check_db_mojibake.js
-
curl -L -o check_db_mojibake.js https://huggingface.co/spaces/shanshal66/chinak2/resolve/main/server/scripts/check_db_mojibake.js
1.34 kB
| import { PrismaClient } from '@prisma/client'; | |
| import fs from 'fs'; | |
| const prisma = new PrismaClient(); | |
| async function checkDb() { | |
| const products = await prisma.product.findMany({ | |
| take: 5, | |
| where: { | |
| OR: [ | |
| { specs: { contains: 'ط§ظ„ظ…ط§ط±ظƒط©' } }, | |
| { specs: { contains: 'الماركة' } } | |
| ] | |
| } | |
| }); | |
| const options = await prisma.productOption.findMany({ | |
| take: 5, | |
| where: { | |
| OR: [ | |
| { name: { contains: 'ط§ظ„ظ…ط§ط±ظƒط©' } }, | |
| { name: { contains: 'الماركة' } } | |
| ] | |
| } | |
| }); | |
| let output = "DB Check Results:\n"; | |
| output += `Found ${products.length} products with relevant specs.\n`; | |
| products.forEach(p => { | |
| output += `Product ID: ${p.id}, Name: ${p.name}\nSpecs: ${p.specs}\n\n`; | |
| }); | |
| output += `Found ${options.length} options with relevant names.\n`; | |
| options.forEach(o => { | |
| output += `Option ID: ${o.id}, Name: ${o.name}\nValues: ${o.values}\n\n`; | |
| }); | |
| console.log(output); | |
| fs.writeFileSync('db_check_result.txt', output); | |
| } | |
| checkDb() | |
| .catch(e => fs.writeFileSync('db_check_result.txt', `Error: ${e.message}`)) | |
| .finally(async () => { | |
| await prisma.$disconnect(); | |
| }); | |