Skip to content

Commit

Permalink
✨ : delete jobs related to stack
Browse files Browse the repository at this point in the history
  • Loading branch information
juwit committed Aug 5, 2022
1 parent 8358021 commit dc9f931
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public void delete(@PathVariable String id, User user){
}
// delete stack if it was found
stackRepository.delete(stack);
jobRepository.deleteByStackId(id);
}

@PostMapping("/{id}/{jobType}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ import org.springframework.stereotype.Repository
interface JobRepository : MongoRepository<Job, String> {

fun findAllByStackIdOrderByScheduleTimeDesc(stackId: String): List<Job>
fun deleteByStackId(stackId: String);

}
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ void delete_shouldRemoveStack_forAdmin(){

// then
verify(stackRepository).delete(stack);
verify(jobRepository).deleteByStackId("42");
}

@Test
Expand All @@ -195,6 +196,7 @@ void delete_shouldRemoveStack_forStandardUser() {

// then
verify(stackRepository).delete(stack);
verify(jobRepository).deleteByStackId("42");
}

@Test
Expand All @@ -208,6 +210,7 @@ void delete_shouldRemoveStack_forUserWithoutOrganization() {

// then
verify(stackRepository).delete(stack);
verify(jobRepository).deleteByStackId("42");
}

@Test
Expand Down

0 comments on commit dc9f931

Please sign in to comment.