remove descriptionTemplateNewVersion users required validator and default user logic

This commit is contained in:
amentis 2024-05-01 13:53:22 +03:00
parent a591c66875
commit 3c72b741c5
2 changed files with 0 additions and 17 deletions

View File

@ -182,9 +182,6 @@ public class NewVersionDescriptionTemplatePersist {
.on(NewVersionDescriptionTemplatePersist._definition)
.over(item.getDefinition())
.using(() -> this.validatorFactory.validator(DefinitionPersist.DefinitionPersistValidator.class)),
this.spec()
.must(() -> !this.isListNullOrEmpty(item.getUsers()))
.failOn(NewVersionDescriptionTemplatePersist._users).failWith(messageSource.getMessage("Validation_Required", new Object[]{NewVersionDescriptionTemplatePersist._users}, LocaleContextHolder.getLocale())),
this.navSpec()
.iff(() -> !this.isListNullOrEmpty(item.getUsers()))
.on(NewVersionDescriptionTemplatePersist._users)

View File

@ -188,8 +188,6 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
this.entityManager.persist(data);
this.persistUsers(data.getId(), model.getUsers());
if (this.conventionService.isListNullOrEmpty(model.getUsers()))
this.addOwner(data);
this.entityManager.flush();
@ -284,18 +282,6 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
this.eventHandler.handle(event);
}
private void addOwner(DescriptionTemplateEntity descriptionTemplateEntity) throws InvalidApplicationException {
UserDescriptionTemplateEntity data = new UserDescriptionTemplateEntity();
data.setId(UUID.randomUUID());
data.setIsActive(IsActive.Active);
data.setCreatedAt(Instant.now());
data.setUpdatedAt(Instant.now());
data.setRole(UserDescriptionTemplateRole.Owner);
data.setUserId(this.userScope.getUserId());
data.setDescriptionTemplateId(descriptionTemplateEntity.getId());
this.entityManager.persist(data);
}
private @NotNull DefinitionEntity buildDefinitionEntity(DefinitionPersist persist) throws InvalidApplicationException {
DefinitionEntity data = new DefinitionEntity();
if (persist == null)