debug: добавить скрипты отладки и бэкапы для диагностики проблем
- api_keys_backup_1758196936364.json - резервная копия API ключей - check-active-key.js - проверка активного API ключа - check-all-keys.js - проверка всех API ключей в системе - check-new-seller.js - проверка нового селлера - test-api-key-save.js - тестирование сохранения API ключей - test-graphql-stats.js - тестирование GraphQL статистики - test-resolver-direct.js - прямое тестирование резолверов - test-sidebar.html - тестирование сайдбара - test-statistics-direct.js - прямое тестирование статистики 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
71
check-new-seller.js
Normal file
71
check-new-seller.js
Normal file
@ -0,0 +1,71 @@
|
||||
import { PrismaClient } from '@prisma/client'
|
||||
const prisma = new PrismaClient()
|
||||
|
||||
async function checkNewSeller() {
|
||||
try {
|
||||
// Найдем пользователя с номером 79988888888
|
||||
const user = await prisma.user.findFirst({
|
||||
where: { phone: '79988888888' },
|
||||
include: {
|
||||
organization: {
|
||||
include: {
|
||||
apiKeys: {
|
||||
where: { marketplace: 'WILDBERRIES' },
|
||||
orderBy: { createdAt: 'desc' },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
if (!user) {
|
||||
console.log('❌ Пользователь 79988888888 не найден')
|
||||
return
|
||||
}
|
||||
|
||||
console.log('👤 НОВЫЙ ПОЛЬЗОВАТЕЛЬ 79988888888:')
|
||||
console.log('- ID:', user.id)
|
||||
console.log('- Телефон:', user.phone)
|
||||
console.log('- Организация:', user.organization?.name || 'НЕ ПРИВЯЗАНА')
|
||||
|
||||
if (user.organization) {
|
||||
console.log('\n🏢 ОРГАНИЗАЦИЯ:')
|
||||
console.log('- ID:', user.organization.id)
|
||||
console.log('- Название:', user.organization.name)
|
||||
console.log('- Тип:', user.organization.type)
|
||||
console.log('- WB ключей:', user.organization.apiKeys.length)
|
||||
|
||||
if (user.organization.apiKeys.length > 0) {
|
||||
console.log('\n🔑 API КЛЮЧИ WILDBERRIES:')
|
||||
user.organization.apiKeys.forEach((key, index) => {
|
||||
console.log(`\n--- КЛЮЧ ${index + 1} ---`)
|
||||
console.log('- ID:', key.id)
|
||||
console.log('- Длина:', key.apiKey?.length)
|
||||
console.log('- Тип:', key.apiKey?.startsWith('eyJ') ? 'Валидный JWT' : 'Тестовый')
|
||||
console.log('- Активен:', key.isActive)
|
||||
console.log('- Создан:', key.createdAt.toISOString())
|
||||
console.log('- Данные валидации:', JSON.stringify(key.validationData, null, 2))
|
||||
})
|
||||
|
||||
// Найдем самый новый валидный ключ
|
||||
const validKey = user.organization.apiKeys.find((key) => key.apiKey && key.apiKey.length > 100 && key.isActive)
|
||||
|
||||
if (validKey) {
|
||||
console.log('\n✅ СТАТУС: Есть валидный API ключ')
|
||||
console.log('- Можно получать статистику Wildberries')
|
||||
} else {
|
||||
console.log('\n⚠️ СТАТУС: Только тестовые ключи')
|
||||
console.log('- Статистика будет пустой')
|
||||
}
|
||||
} else {
|
||||
console.log('\n❌ API КЛЮЧИ НЕ НАЙДЕНЫ')
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('❌ Ошибка:', error)
|
||||
} finally {
|
||||
await prisma.$disconnect()
|
||||
}
|
||||
}
|
||||
|
||||
checkNewSeller()
|
Reference in New Issue
Block a user