Skip to content

Commit

Permalink
remove unused methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Tcharl committed Nov 19, 2024
1 parent 648e573 commit 56fa386
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 57 deletions.
32 changes: 3 additions & 29 deletions generators/angular/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,7 @@ import BaseApplicationGenerator from '../base-application/index.js';
import { GENERATOR_ANGULAR, GENERATOR_CLIENT, GENERATOR_LANGUAGES } from '../generator-list.js';
import { defaultLanguage } from '../languages/support/index.js';
import { clientFrameworkTypes } from '../../lib/jhipster/index.js';
import {
generateTypescriptTestEntity as generateTestEntity,
generateEntityClientEnumImports as getClientEnumImportsFormat,
generateTestEntityId as getTestEntityId,
generateTestEntityPrimaryKey as getTestEntityPrimaryKey,
} from '../client/support/index.js';
import { generateEntityClientEnumImports as getClientEnumImportsFormat } from '../client/support/index.js';
import { createNeedleCallback, mutateData } from '../base/support/index.js';
import { writeEslintClientRootConfigFile } from '../javascript/generators/eslint/support/tasks.js';
import type { TaskTypes as DefaultTaskTypes } from '../../lib/types/application/tasks.js';
Expand All @@ -41,19 +36,14 @@ import {
addItemToAdminMenu,
addRoute,
addToEntitiesMenu,
buildAngularFormPath as angularFormPath,
isTranslatedAngularFile,
translateAngularFilesTransform,
} from './support/index.js';
import type { AngularApplication, AngularEntity } from './types.js';

const { ANGULAR } = clientFrameworkTypes;

export default class AngularGenerator extends BaseApplicationGenerator<
AngularEntity,
AngularApplication,
DefaultTaskTypes<AngularEntity, AngularApplication>
> {
export default class AngularGenerator extends BaseApplicationGenerator<DefaultTaskTypes<AngularEntity, AngularApplication>> {
async beforeQueue() {
if (!this.fromBlueprint) {
await this.composeWithBlueprints();
Expand Down Expand Up @@ -182,22 +172,6 @@ export default class AngularGenerator extends BaseApplicationGenerator<
entity.generateEntityClientEnumImports = fields => {
return getClientEnumImportsFormat(fields, ANGULAR);
};

entity.generateTestEntityPrimaryKey = (primaryKey, index) => {
return getTestEntityPrimaryKey(primaryKey, index);
};

entity.generateTypescriptTestEntity = (references, additionalFields) => {
return generateTestEntity(references, additionalFields);
};

entity.buildAngularFormPath = (reference, prefix = []) => {
return angularFormPath(reference, prefix);
};

entity.generateTestEntityId = (primaryKey, index: 0 | 1 | 'random' = 0, wrapped = true) => {
return getTestEntityId(primaryKey, index, wrapped);
};
},
});
}
Expand Down Expand Up @@ -245,7 +219,7 @@ export default class AngularGenerator extends BaseApplicationGenerator<
return this.asDefaultTaskGroup({
loadEntities({ application }) {
const entities = this.sharedData.getEntities().map(({ entity }) => entity);
application.angularEntities = entities.filter(entity => !entity.builtIn && !entity.skipClient);
application.angularEntities = entities.filter(entity => !entity.builtIn && !entity.skipClient) as AngularEntity[];
},
queueTranslateTransform({ control, application }) {
const { enableTranslation, jhiPrefix } = application;
Expand Down
27 changes: 1 addition & 26 deletions generators/angular/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import type { Entity } from '../../lib/types/application/entity.js';
import type { ApplicationType } from '../../lib/types/application/application.js';
import type { Entity } from '../../lib/types/application/index.js';

export interface AngularEntity extends Entity {
/**
* generates a value for a primary key type
* @param primaryKey the primary key attribute (or its type) of the entity
* @param index an index to add salt to the value
* @param wrapped if the value should be within quotes
* @returns {string|number|string}
*/
generateTestEntityId: (primaryKey: any, index?: 0 | 1 | 'random', wrapped?: boolean) => any;
/**
* @private
* Create a angular form path getter method of reference.
*
* @param {object} reference
* @param {string[]} prefix
* @return {string}
*/
buildAngularFormPath: (reference: any, prefix?: never[]) => string;
/**
* @private
* Generate a test entity instance with faked values.
*
* @param {any} references - references to other entities.
* @param {any} additionalFields - additional fields to add to the entity or with default values that overrides generated values.
*/
generateTypescriptTestEntity: (references: any, additionalFields: any) => string;
/**
* @private
* Generate a test entity, for the PK references (when the PK is a composite, derived key)
Expand Down
3 changes: 1 addition & 2 deletions lib/types/application/entity.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ type ClientSample = Record<string, string | number | boolean | null>;

export interface Entity<F extends BaseField = Field, R extends BaseRelationship = never>
extends Omit<Required<BaseEntity<F>>, 'relationships'>,
ServerEntity,
AngularEntity {
ServerEntity {
changelogDateForRecent: any;
/** @experimental */
auditableEntity?: boolean;
Expand Down

0 comments on commit 56fa386

Please sign in to comment.