Skip to content

Commit

Permalink
Clean code: Remove unused constant (#28368)
Browse files Browse the repository at this point in the history
  • Loading branch information
qmonmert authored Jan 1, 2025
1 parent 3e7c2be commit b59e15a
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ _%>
<%_ } _%>
<%_ } _%>
<%_ for (const relationship of relationships.filter(rel => rel.persistableRelationship || rel.relationshipEagerLoad)) {
const { propertyName, relationshipRequired, otherEntity, collection, otherEntityField } = relationship;
const { propertyName, otherEntity, collection, otherEntityField } = relationship;
_%>
<%= propertyName %>?: <% if (!otherEntity.embedded && (dtoMapstruct || otherEntity.builtInUser)) { %>Pick<<% } %>I<%= otherEntity.entityAngularName %><% if (!otherEntity.embedded && (dtoMapstruct || otherEntity.builtInUser)) { %>, '<%= otherEntity.primaryKey.name %>'<% if (otherEntity.primaryKey.name !== otherEntityField) { %> | '<%= otherEntityField %>'<% } %>><% } %><% if (collection) { %>[]<% } %> | null;
<%_ } _%>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ for (const relationship of relationships.filter(rel => !rel.otherEntityIsEmbedde
const relationshipName = relationship.relationshipName;
const relationshipFieldName = relationship.relationshipFieldName;
const relationshipFieldNamePlural = relationship.relationshipFieldNamePlural;
const relationshipNameHumanized = relationship.relationshipNameHumanized;
const otherEntityField = relationship.otherEntityField;
if (persistableRelationship) {
_%>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
const fieldTypeBlobContent = field.fieldTypeBlobContent;
const readonly = field.readonly;
let fieldInputType = 'text';
const translationKey = field.fieldTranslationKey;
if (field.fieldTypeNumeric) {
fieldInputType = 'number';
} else if (field.fieldTypeLocalDate) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ describe('<%= entityClass %> e2e test', () => {
<%_ } _%>
<%_ }); _%>
<%_ for (relationship of requiredRelationships) {
const relationshipName = relationship.relationshipName;
_%>
cy.get(`[data-cy="<%= relationship.relationshipFieldName %>"]`).select(<%= relationship.collection ? '[0]' : '1' %>);
<%_ } _%>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class <%- entityClass %>CriteriaTest {
}

private static void setAllFilters(<%- entityClass %>Criteria <%- persistInstance %>Criteria) {
<%_ for (const { propertyJavaFilterName, propertyJavaFilterJavaBeanName } of entityJavaFilterableProperties) { _%>
<%_ for (const { propertyJavaFilterName } of entityJavaFilterableProperties) { _%>
<%- persistInstance %>Criteria.<%- propertyJavaFilterName %>();
<%_ } _%>
<%- persistInstance %>Criteria.distinct();
Expand All @@ -85,10 +85,10 @@ class <%- entityClass %>CriteriaTest {
private static Condition<<%- entityClass %>Criteria> criteriaFiltersAre(Function<Object, Boolean> condition) {
return new Condition<>(
criteria ->
<%_ for (const { propertyJavaFilterName, propertyJavaFilterJavaBeanName } of entityJavaFilterableProperties) { _%>
<%_ for (const { propertyJavaFilterJavaBeanName } of entityJavaFilterableProperties) { _%>
condition.apply(criteria.get<%- propertyJavaFilterJavaBeanName %>()) &&
<%_ } _%>

condition.apply(criteria.getDistinct()),
"every filter matches"
);
Expand All @@ -97,7 +97,7 @@ class <%- entityClass %>CriteriaTest {
private static Condition<<%- entityClass %>Criteria> copyFiltersAre(<%- entityClass %>Criteria copy, BiFunction<Object, Object, Boolean> condition) {
return new Condition<>(
criteria ->
<%_ for (const { propertyJavaFilterName, propertyJavaFilterJavaBeanName } of entityJavaFilterableProperties) { _%>
<%_ for (const { propertyJavaFilterJavaBeanName } of entityJavaFilterableProperties) { _%>
condition.apply(criteria.get<%- propertyJavaFilterJavaBeanName %>(), copy.get<%- propertyJavaFilterJavaBeanName %>()) &&
<%_ } _%>
condition.apply(criteria.getDistinct(), copy.getDistinct()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,7 @@ fields.forEach((field) => {
}
<%_ } _%>
<%_ }); _%>
<%_ reactiveEagerRelations.forEach((relationship) => {
const metamodelFieldName = (relationship.relationshipManyToMany || relationship.relationshipOneToMany) ? relationship.relationshipFieldNamePlural : relationship.relationshipFieldName; _%>
<%_ reactiveEagerRelations.forEach((relationship) => { _%>
if (criteria.get<%= relationship.relationshipNameCapitalized %>Id() != null) {
builder.buildFilterConditionForField(criteria.get<%= relationship.relationshipNameCapitalized %>Id(), <%= relationship.relationshipName %>Table.column("<%= relationship.otherEntity.primaryKey.ownFields[0].columnName %>"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public interface <%= entityClass %>Repository extends ReactiveCrudRepository<<%=

<%_ } _%>
<%_ for (const relationship of relationships) {
let relationshipName = relationship.relationshipName;
let ownerSide = relationship.ownerSide; _%>
<%_ if (relationship.relationshipManyToOne || (relationship.relationshipOneToOne && ownerSide)) { _%>

Expand All @@ -71,7 +70,6 @@ public interface <%= entityClass %>Repository extends ReactiveCrudRepository<<%=
@Query("SELECT entity.* FROM <%= entityTableName %> entity JOIN <%= relationship.joinTable.name %> joinTable ON entity.<%= primaryKey.fields[0].columnName %> = joinTable.<%= relationship.joinColumnNames[0] %> WHERE joinTable.<%= relationship.joinColumnNames[0] %> = :id")
Flux<<%= persistClass %>> findBy<%= relationship.relationshipNameCapitalized %>(<%= primaryKey.type %> id);
<%_ } else if (relationship.relationshipOneToOne && !ownerSide) {
let otherEntityRelationshipName = relationship.otherEntityRelationshipName;
let otherEntityTableName = relationship.otherEntityTableName;
_%>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default defineComponent({
setup() {
const <%= entityInstance %>Service = inject('<%= entityInstance %>Service', () => new <%= entityAngularName %>Service());
const alertService = inject('alertService', () => useAlertService(), true);

const <%= entityInstance %>: Ref<I<%= entityAngularName %>> = ref(new <%= entityAngularName %>());
<%_ for (const [relationship] of Object.values(allRelationshipsThatNeedSelectOptions)) { _%>
<%_ if (relationship.otherEntity.builtInUser) { _%>
Expand Down Expand Up @@ -186,10 +186,6 @@ _%>
methods: {
save() : void {
this.isSaving = true;
<%_ for (field of fields.filter(field => !field.id)) {
const fieldName = field.fieldName;
const fieldType = field.fieldType;
} _%>
if (this.<%= entityInstance %>.<%= primaryKey.name %>) {
this.<%= entityInstance %>Service().update(this.<%= entityInstance %>).then((param) => {
this.isSaving = false;
Expand Down

0 comments on commit b59e15a

Please sign in to comment.