@Test public void delete_by_organization() { underTest.insert(dbSession, create("O1", 512)); underTest.insert(dbSession, create("O1", 513)); underTest.insert(dbSession, create("O2", 512)); underTest.deleteByOrganizationUuid(dbSession, "O1"); assertThat(underTest.select(dbSession, "O1", 512)).isNotPresent(); assertThat(underTest.select(dbSession, "O1", 513)).isNotPresent(); assertThat(underTest.select(dbSession, "O2", 512)).isPresent(); }
private void deleteOrganization(DbSession dbSession, OrganizationDto organization) { Collection<String> uuids = dbClient.organizationMemberDao().selectUserUuidsByOrganizationUuid(dbSession, organization.getUuid()); dbClient.organizationMemberDao().deleteByOrganizationUuid(dbSession, organization.getUuid()); dbClient.organizationDao().deleteByUuid(dbSession, organization.getUuid()); dbClient.userDao().cleanHomepage(dbSession, organization); dbClient.webhookDao().selectByOrganizationUuid(dbSession, organization.getUuid()) .forEach(wh -> dbClient.webhookDeliveryDao().deleteByWebhook(dbSession, wh)); dbClient.webhookDao().deleteByOrganization(dbSession, organization); List<UserDto> users = dbClient.userDao().selectByUuids(dbSession, uuids); userIndexer.commitAndIndex(dbSession, users); }
private void deleteOrganization(DbSession dbSession, OrganizationDto organization) { Collection<String> uuids = dbClient.organizationMemberDao().selectUserUuidsByOrganizationUuid(dbSession, organization.getUuid()); dbClient.organizationMemberDao().deleteByOrganizationUuid(dbSession, organization.getUuid()); dbClient.organizationDao().deleteByUuid(dbSession, organization.getUuid()); dbClient.userDao().cleanHomepage(dbSession, organization); dbClient.webhookDao().selectByOrganizationUuid(dbSession, organization.getUuid()) .forEach(wh -> dbClient.webhookDeliveryDao().deleteByWebhook(dbSession, wh)); dbClient.webhookDao().deleteByOrganization(dbSession, organization); List<UserDto> users = dbClient.userDao().selectByUuids(dbSession, uuids); userIndexer.commitAndIndex(dbSession, users); }