Skip to content

Commit

Permalink
Merge pull request #2611 from uselagoon/feature/delete-problem-mutati…
Browse files Browse the repository at this point in the history
…on-changes

adding service to deleteProblem mutation
  • Loading branch information
tobybellwood authored Dec 7, 2023
2 parents b8ff06a + bc99d18 commit 979b645
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
6 changes: 3 additions & 3 deletions services/api/src/resources/problem/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ export const addProblem: ResolverFn = async (

export const deleteProblem: ResolverFn = async (
root,
{ input: { environment: environmentId, identifier } },
{ sqlClientPool, hasPermission, userActivityLogger }
{ input: { environment: environmentId, identifier, service } },
{ sqlClientPool, hasPermission, userActivityLogger }
) => {
const environment = await environmentHelpers(
sqlClientPool
Expand All @@ -226,7 +226,7 @@ export const deleteProblem: ResolverFn = async (
project: environment.project
});

await query(sqlClientPool, Sql.deleteProblem(environmentId, identifier));
await query(sqlClientPool, Sql.deleteProblem(environmentId, identifier, service));

userActivityLogger(`User deleted a problem on environment '${environment.name}' for '${environment.project}'`, {
project: '',
Expand Down
13 changes: 8 additions & 5 deletions services/api/src/resources/problem/sql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,17 @@ export const Sql = {
created
})
.toString(),
deleteProblem: (environment, identifier) =>
knex('environment_problem')
deleteProblem: (environment, identifier, service) => {
let q = knex('environment_problem')
.where({
environment: environment,
identifier: identifier
})
.del()
.toString(),
});
if (service != undefined) {
q.where('lagoon_service', service);
}
return q.del().toString();
},
deleteProblemsFromSource: (environment, source, service) =>
knex('environment_problem')
.where({
Expand Down
1 change: 1 addition & 0 deletions services/api/src/typeDefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ const typeDefs = gql`
input DeleteProblemInput {
environment: Int!
identifier: String!
service: String
}
input DeleteProblemsFromSourceInput {
Expand Down

0 comments on commit 979b645

Please sign in to comment.