Skip to content

Commit

Permalink
Merge pull request #3706 from uselagoon/update-notification-fix
Browse files Browse the repository at this point in the history
Fix: Updates updateNotification resolvers & removes channel from UpdateNotificationMicrosoftTeamsPatchInput
  • Loading branch information
tobybellwood authored Sep 9, 2024
2 parents 0c3d72c + ec433f9 commit 268e5f5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
20 changes: 10 additions & 10 deletions services/api/src/resources/notification/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
Expand All @@ -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)
Expand All @@ -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);
Expand All @@ -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)
Expand All @@ -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);
Expand All @@ -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)
Expand All @@ -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);
Expand All @@ -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)
Expand All @@ -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);
Expand Down
1 change: 0 additions & 1 deletion services/api/src/typeDefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2076,7 +2076,6 @@ const typeDefs = gql`
input UpdateNotificationMicrosoftTeamsPatchInput {
name: String
webhook: String
channel: String
}
input UpdateNotificationEmailPatchInput {
name: String
Expand Down
1 change: 0 additions & 1 deletion services/workflows/internal/lagoonclient/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1976,7 +1976,6 @@ input UpdateNotificationMicrosoftTeamsInput {
input UpdateNotificationMicrosoftTeamsPatchInput {
name: String
webhook: String
channel: String
}

input UpdateNotificationRocketChatInput {
Expand Down

0 comments on commit 268e5f5

Please sign in to comment.