docs: добавить планы улучшения архитектуры SFERA

This commit is contained in:
Veronika Smirnova
2025-09-18 21:28:07 +03:00
parent 733ccadeb7
commit 3efc387308
18 changed files with 3130 additions and 74 deletions

View File

@ -166,7 +166,46 @@ export const wildberriesResolvers: DomainResolvers = {
}
const wbService = new WildberriesService(apiKey.apiKey)
const statistics = await wbService.getStatistics(args.startDate, args.endDate)
console.log('🔑 API Key length:', apiKey.apiKey?.length)
console.log('📅 Date params:', { startDate: args.startDate, endDate: args.endDate, period: args.period })
// Если нет конкретных дат, генерируем их на основе периода
let startDate = args.startDate
let endDate = args.endDate
if (!startDate || !endDate) {
const now = new Date()
const today = now.toISOString().split('T')[0] // YYYY-MM-DD
switch (args.period) {
case 'week':
const weekAgo = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000)
startDate = weekAgo.toISOString().split('T')[0]
endDate = today
break
case 'month':
const monthAgo = new Date(now.getTime() - 30 * 24 * 60 * 60 * 1000)
startDate = monthAgo.toISOString().split('T')[0]
endDate = today
break
default:
// По умолчанию неделя
const defaultWeekAgo = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000)
startDate = defaultWeekAgo.toISOString().split('T')[0]
endDate = today
}
}
console.log('📅 Calculated dates:', { startDate, endDate })
const statistics = await wbService.getStatistics(startDate, endDate)
console.log('📊 Statistics result:', {
type: typeof statistics,
isArray: Array.isArray(statistics),
length: statistics?.length,
firstItem: statistics?.[0] ? Object.keys(statistics[0]) : null
})
console.log('✅ GET_WILDBERRIES_STATISTICS DOMAIN SUCCESS')