fix: Error deleting application when soft-deleted entities are present in the application (#18185)

* fix: Error deleting application when soft-deleted entities are present in the application

* Review changes
This commit is contained in:
Vishnu Gp 2022-11-16 20:15:38 +05:30 committed by GitHub
parent 8bc40c91d9
commit 4402b35247
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -146,7 +146,10 @@ public class BaseRepositoryImpl<T extends BaseDomain, ID extends Serializable> e
public Mono<T> archive(T entity) {
Assert.notNull(entity, "The given entity must not be null!");
Assert.notNull(entity.getId(), "The given entity's id must not be null!");
Assert.isTrue(!entity.isDeleted(), "The given entity is already deleted");
// Entity is already deleted
if (entity.isDeleted()) {
return Mono.just(entity);
}
entity.setDeleted(true);
entity.setDeletedAt(Instant.now());