From e804a9eaecb48bfcbdec213c328792bfc4d2c10a Mon Sep 17 00:00:00 2001 From: petruki <31597636+petruki@users.noreply.github.com> Date: Wed, 1 Nov 2023 19:45:01 -0700 Subject: [PATCH 1/4] Fixes duplicated environment deletion --- src/routers/environment.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/routers/environment.js b/src/routers/environment.js index bb239bd..28033ce 100644 --- a/src/routers/environment.js +++ b/src/routers/environment.js @@ -58,7 +58,6 @@ router.delete('/environment/:id', auth, [ ], validate, async (req, res) => { try { const environment = await Services.deleteEnvironment(req.params.id, req.admin); - await environment.deleteOne(); res.send(environment); } catch (e) { responseException(res, e, 400); From 96cf66dfe16166136346cadd530cce89697e6d75 Mon Sep 17 00:00:00 2001 From: petruki <31597636+petruki@users.noreply.github.com> Date: Wed, 1 Nov 2023 19:45:50 -0700 Subject: [PATCH 2/4] Fixes slack Domain version update when ticket approved --- src/services/slack.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/services/slack.js b/src/services/slack.js index d7599ef..4256447 100644 --- a/src/services/slack.js +++ b/src/services/slack.js @@ -3,7 +3,7 @@ import { TicketStatusType, SLACK_SUB, TicketValidationType } from '../models/sla import { BadRequestError, NotFoundError, PermissionError } from '../exceptions'; import { checkSlackIntegration } from '../external/switcher-api-facade'; import { getConfig } from './config'; -import { getDomainById } from './domain'; +import { getDomainById, updateDomainVersion } from './domain'; import { getEnvironment } from './environment'; import { getGroupConfig } from './group-config'; import { containsValue } from '../helpers'; @@ -218,4 +218,6 @@ async function approveChange(domain, ticket) { group.updatedBy = SLACK_SUB; await group.save(); } + + updateDomainVersion(domain); } \ No newline at end of file From a832b730f15e3ab54aaea4bdcf7c4663243df61d Mon Sep 17 00:00:00 2001 From: petruki <31597636+petruki@users.noreply.github.com> Date: Wed, 1 Nov 2023 19:47:26 -0700 Subject: [PATCH 3/4] Fixes relay removal --- src/services/config.js | 2 +- tests/config-relay.test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/config.js b/src/services/config.js index 979fba3..67575a1 100644 --- a/src/services/config.js +++ b/src/services/config.js @@ -286,7 +286,7 @@ export async function removeRelay(id, env, admin) { config.relay.auth_token.delete(env); config.relay.verified.delete(env); } else { - config.relay = {}; + config.relay = undefined; } await config.save(); diff --git a/tests/config-relay.test.js b/tests/config-relay.test.js index 0401f51..5a87e50 100644 --- a/tests/config-relay.test.js +++ b/tests/config-relay.test.js @@ -357,7 +357,7 @@ describe('Testing relay association', () => { .send().expect(200); const config = await Config.findById(configId1).lean().exec(); - expect(config.relay).toEqual({}); + expect(config.relay).toEqual(undefined); }); test('CONFIG_RELAY_SUITE - Should get Relay specs', async () => { From a543f11ae8cd133feb4f4ef8495b7573b8cbf414 Mon Sep 17 00:00:00 2001 From: petruki <31597636+petruki@users.noreply.github.com> Date: Wed, 1 Nov 2023 19:48:05 -0700 Subject: [PATCH 4/4] Bump mongoose to v8 --- package.json | 2 +- tests/team.test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index c63fcbf..7969d8e 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "jsonwebtoken": "^9.0.2", "moment": "^2.29.4", "mongodb": "^6.2.0", - "mongoose": "^7.6.3", + "mongoose": "^8.0.0", "pino": "^8.16.1", "pino-pretty": "^10.2.3", "swagger-ui-express": "^5.0.0", diff --git a/tests/team.test.js b/tests/team.test.js index 0d4d8c1..5350a44 100644 --- a/tests/team.test.js +++ b/tests/team.test.js @@ -332,7 +332,7 @@ describe('Updating team members tests', () => { await request(app) .post(`/team/member/invite/accept/${teamInvite._id}`) .set('Authorization', `Bearer ${adminMasterAccountToken}`) - .send().expect(404); + .send().expect(400); }); test('TEAM_SUITE - Should NOT create invite request - Invalid Team ID', async () => {