Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean code: Remove unused constant #28368

Merged
merged 3 commits into from
Jan 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading