From 4c764eb794ae59fa602dcc349a635acaafcb3f62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNaeel=E2=80=9D?= Date: Mon, 22 Jun 2026 18:20:25 +0400 Subject: [PATCH] =?UTF-8?q?v0.5.170:=20action=3Dwipe=20=E2=80=94=20=D1=83?= =?UTF-8?q?=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B2=D1=81=D0=B5?= =?UTF-8?q?=D1=85=20=D0=B7=D0=B0=D0=BF=D0=B8=D1=81=D0=B5=D0=B9=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=BC=D0=BF=D0=B0=D0=BD=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- v2/src/config/index.js | 2 +- v2/src/test/index.js | 9 +++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) 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.