diff --git a/package.json b/package.json index ed619ae..0606095 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ipwhitelist", - "version": "0.5.169", + "version": "0.5.170", "description": "IP WhiteList microservice for cloud provider", "main": "server.js", "scripts": { diff --git a/v2/src/config/index.js b/v2/src/config/index.js index 5c1a545..d10355d 100644 --- a/v2/src/config/index.js +++ b/v2/src/config/index.js @@ -8,7 +8,7 @@ // ═══════════════════════════════════════════════════════════════════════════════ module.exports = { - version: '0.5.169', + version: '0.5.170', // ── IAM ────────────────────────────────────────────────────────────────── iamUrl: process.env.V2_IAM_URL || 'https://auth-api.ngcloud.ru/api/v1/auth/user', diff --git a/v2/src/test/index.js b/v2/src/test/index.js index 870c36c..7cdc8df 100644 --- a/v2/src/test/index.js +++ b/v2/src/test/index.js @@ -114,6 +114,15 @@ function createTestRouter() { return res.json({ ok: true }); } + // ── WIPE: удалить все записи и аудит компании (clientId) ─ + case 'wipe': { + const clientId = req.query.clientId; + if (!clientId) return res.json({ ok: false, error: 'clientId required' }); + const e = await pool.query('DELETE FROM v2_entries WHERE company_id IN (SELECT id FROM v2_companies WHERE client_id=$1)', [clientId]); + const a = await pool.query('DELETE FROM v2_audit WHERE company_id IN (SELECT id FROM v2_companies WHERE client_id=$1)', [clientId]); + return res.json({ ok: true, entriesDeleted: e.rowCount, auditDeleted: a.rowCount, clientId }); + } + // ── USERFLOW: полная эмуляция юзера через все слои ────── // Отличие от add/edit/delete: здесь выставляется мок-сессия // как после KC+IAM+resolveContext, и вызывается crud.