Enhance account synchronization with optional tariff syncing
- Updated `syncAccount` function to accept options for selective synchronization. - Modified `syncFromBillmanager` to handle new options for skipping tariff syncs. - Adjusted `TariffsPage` to utilize the new option for syncing only tariffs. - Removed unused tariff tracking from `VpsPage` and updated sync message logic accordingly.
This commit is contained in:
@@ -64,6 +64,7 @@ router.post('/:accountId', async (req, res) => {
|
||||
try {
|
||||
const db = getDb()
|
||||
const { accountId } = req.params
|
||||
const { onlyTariffs = false } = req.body || {}
|
||||
const row = db.prepare('SELECT * FROM provider_accounts WHERE id = ?').get(accountId)
|
||||
if (!row) {
|
||||
return res.status(404).json({ error: 'Account not found' })
|
||||
@@ -81,7 +82,8 @@ router.post('/:accountId', async (req, res) => {
|
||||
VALUES (?, ?, ?, ?)
|
||||
`).run(logId, accountId, new Date().toISOString(), 'running')
|
||||
|
||||
const result = await syncFromBillmanager(row, db)
|
||||
const opts = onlyTariffs ? { skipVpsPayments: true } : { skipTariffs: true }
|
||||
const result = await syncFromBillmanager(row, db, opts)
|
||||
|
||||
db.prepare(`
|
||||
UPDATE sync_log SET finishedAt=?, status=?, vpsCount=?, paymentsCount=?
|
||||
|
||||
Reference in New Issue
Block a user