-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added delete application endpoint
- Loading branch information
1 parent
1e73be2
commit 317c061
Showing
11 changed files
with
152 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/main/java/org/tkit/onecx/permission/domain/services/ApplicationService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.tkit.onecx.permission.domain.services; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
import jakarta.inject.Inject; | ||
import jakarta.transaction.Transactional; | ||
|
||
import org.tkit.onecx.permission.domain.daos.ApplicationDAO; | ||
import org.tkit.onecx.permission.domain.daos.AssignmentDAO; | ||
import org.tkit.onecx.permission.domain.daos.PermissionDAO; | ||
import org.tkit.quarkus.jpa.models.TraceableEntity; | ||
|
||
@ApplicationScoped | ||
public class ApplicationService { | ||
|
||
@Inject | ||
AssignmentDAO assignmentDAO; | ||
|
||
@Inject | ||
PermissionDAO permissionDAO; | ||
|
||
@Inject | ||
ApplicationDAO applicationDAO; | ||
|
||
@Transactional | ||
public void deleteApplicationAndRelatedPermissionsAndAssignmentsById(String id, String applicationId) { | ||
applicationDAO.deleteQueryById(id); | ||
var permissions = permissionDAO.findByAppId(applicationId); | ||
var permissionsIds = permissions.stream().map(TraceableEntity::getId).toList(); | ||
assignmentDAO.deleteByPermissionIds(permissionsIds); | ||
permissionDAO.delete(permissions); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters