feat: consolidate provider API sources with heuristic support
Docker / build (push) Failing after 18s
Docker / build (push) Failing after 18s
Updated the database migration logic to consolidate provider API sources from both accounts and heuristic methods for BILLmanager URLs. Replaced direct calls to `consolidateProviderApiFromAccounts` with `consolidateAllProviderApiSources` in relevant routes to ensure comprehensive API data handling.
This commit is contained in:
@@ -2,7 +2,7 @@ import { Router } from 'express'
|
||||
import express from 'express'
|
||||
import { readFileSync, existsSync } from 'node:fs'
|
||||
import { getDb, saveDb, DB_PATH, reloadDatabaseFromBuffer } from '../db.js'
|
||||
import { consolidateProviderApiFromAccounts } from '../db/migrations.js'
|
||||
import { consolidateAllProviderApiSources } from '../db/migrations.js'
|
||||
import { rowToVps } from './vps.js'
|
||||
import { rowToActiveTariff, rowToTariffSyncOptions } from '../utils/row-mappers.js'
|
||||
|
||||
@@ -162,7 +162,7 @@ function importJsonSnapshot(data) {
|
||||
)
|
||||
}
|
||||
|
||||
consolidateProviderApiFromAccounts(db)
|
||||
consolidateAllProviderApiSources(db)
|
||||
|
||||
const settingsList = Array.isArray(data.settings) ? data.settings : data.settings ? [data.settings] : []
|
||||
for (const s of settingsList) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Router } from 'express'
|
||||
import { getDb, saveDb } from '../db.js'
|
||||
import { consolidateProviderApiFromAccounts } from '../db/migrations.js'
|
||||
import { consolidateAllProviderApiSources } from '../db/migrations.js'
|
||||
|
||||
const router = Router()
|
||||
|
||||
@@ -72,7 +72,7 @@ router.post('/', (req, res) => {
|
||||
db.run(sql, s.id ?? 'settings-main', s.baseCurrency ?? 'RUB', s.ratesUrl ?? '', s.autoConvert !== false ? 1 : 0, s.ratesUpdatedAt ?? '', s.syncEnabled ? 1 : 0, s.syncIntervalMinutes ?? 60)
|
||||
}
|
||||
}
|
||||
consolidateProviderApiFromAccounts(db)
|
||||
consolidateAllProviderApiSources(db)
|
||||
saveDb()
|
||||
|
||||
res.json({ ok: true })
|
||||
|
||||
Reference in New Issue
Block a user