From ec433f9afd8be63351e6b9e07d804f402d0e5d16 Mon Sep 17 00:00:00 2001 From: cgoodwin90 Date: Mon, 8 Apr 2024 17:55:44 +1000 Subject: [PATCH] Updates updateNotification resolvers & removes channel from UpdateNotificationMicrosoftTeamsPatchInput --- .../src/resources/notification/resolvers.ts | 20 +++++++++---------- services/api/src/typeDefs.js | 1 - .../internal/lagoonclient/schema.graphql | 1 - 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/services/api/src/resources/notification/resolvers.ts b/services/api/src/resources/notification/resolvers.ts index 4a1a5c6453..3e00f1a715 100644 --- a/services/api/src/resources/notification/resolvers.ts +++ b/services/api/src/resources/notification/resolvers.ts @@ -511,7 +511,7 @@ export const updateNotificationMicrosoftTeams: ResolverFn = async ( if (isPatchEmpty(input)) { throw new Error('input.patch requires at least 1 attribute'); } - const { name } = input; + const { name, patch: {name: newName = ''} } = input; const check = await query( sqlClientPool, Sql.selectNotificationMicrosoftTeamsByName(name) @@ -535,7 +535,7 @@ export const updateNotificationMicrosoftTeams: ResolverFn = async ( const rows = await query( sqlClientPool, - Sql.selectNotificationMicrosoftTeamsByName(name) + Sql.selectNotificationMicrosoftTeamsByName(newName ? newName : name) ); return R.prop(0, rows); @@ -552,7 +552,7 @@ export const updateNotificationWebhook: ResolverFn = async ( if (isPatchEmpty(input)) { throw new Error('input.patch requires at least 1 attribute'); } - const { name } = input; + const { name, patch: {name: newName = ''} } = input; const check = await query( sqlClientPool, Sql.selectNotificationWebhookByName(name) @@ -576,7 +576,7 @@ export const updateNotificationWebhook: ResolverFn = async ( const rows = await query( sqlClientPool, - Sql.selectNotificationWebhookByName(name), + Sql.selectNotificationWebhookByName(newName ? newName : name), ); return R.prop(0, rows); @@ -590,7 +590,7 @@ export const updateNotificationEmail: ResolverFn = async ( if (isPatchEmpty(input)) { throw new Error('input.patch requires at least 1 attribute'); } - const { name } = input; + const { name, patch: {name: newName = ''} } = input; const check = await query( sqlClientPool, Sql.selectNotificationEmailByName(name) @@ -614,7 +614,7 @@ export const updateNotificationEmail: ResolverFn = async ( const rows = await query( sqlClientPool, - Sql.selectNotificationEmailByName(name) + Sql.selectNotificationEmailByName(newName ? newName : name) ); return R.prop(0, rows); @@ -628,7 +628,7 @@ export const updateNotificationRocketChat: ResolverFn = async ( if (isPatchEmpty(input)) { throw new Error('input.patch requires at least 1 attribute'); } - const { name } = input; + const { name, patch: {name: newName = ''} } = input; const check = await query( sqlClientPool, Sql.selectNotificationRocketChatByName(name) @@ -652,7 +652,7 @@ export const updateNotificationRocketChat: ResolverFn = async ( const rows = await query( sqlClientPool, - Sql.selectNotificationRocketChatByName(name) + Sql.selectNotificationRocketChatByName(newName ? newName : name) ); return R.prop(0, rows); @@ -666,7 +666,7 @@ export const updateNotificationSlack: ResolverFn = async ( if (isPatchEmpty(input)) { throw new Error('input.patch requires at least 1 attribute'); } - const { name } = input; + const { name, patch: {name: newName = ''} } = input; const check = await query( sqlClientPool, Sql.selectNotificationSlackByName(name) @@ -690,7 +690,7 @@ export const updateNotificationSlack: ResolverFn = async ( const rows = await query( sqlClientPool, - Sql.selectNotificationSlackByName(name) + Sql.selectNotificationSlackByName(newName ? newName : name) ); return R.prop(0, rows); diff --git a/services/api/src/typeDefs.js b/services/api/src/typeDefs.js index 3c4a61eb4c..ffa8e98719 100644 --- a/services/api/src/typeDefs.js +++ b/services/api/src/typeDefs.js @@ -2076,7 +2076,6 @@ const typeDefs = gql` input UpdateNotificationMicrosoftTeamsPatchInput { name: String webhook: String - channel: String } input UpdateNotificationEmailPatchInput { name: String diff --git a/services/workflows/internal/lagoonclient/schema.graphql b/services/workflows/internal/lagoonclient/schema.graphql index d508c8c08e..f8d04fa5da 100644 --- a/services/workflows/internal/lagoonclient/schema.graphql +++ b/services/workflows/internal/lagoonclient/schema.graphql @@ -1976,7 +1976,6 @@ input UpdateNotificationMicrosoftTeamsInput { input UpdateNotificationMicrosoftTeamsPatchInput { name: String webhook: String - channel: String } input UpdateNotificationRocketChatInput {