Skip to content

Commit

Permalink
fixed #156
Browse files Browse the repository at this point in the history
  • Loading branch information
Angelo Manganiello committed Aug 5, 2020
1 parent e893d81 commit 5172443
Show file tree
Hide file tree
Showing 6 changed files with 1,746 additions and 5,435 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

# [1.1.1](https://github.com/jhipster/generator-jhipster-nodejs/tree/v1.1.1)

- enum type values not correctly mapped in the server side [issue #156](https://github.com/jhipster/generator-jhipster-nodejs/issues/156)
- Error when fetch list of entities from react client [issue #155](https://github.com/jhipster/generator-jhipster-nodejs/issues/155)
- double stitch port on app.yml [issue #153](https://github.com/jhipster/generator-jhipster-nodejs/issues/153)

Expand Down
2 changes: 1 addition & 1 deletion generators/entity-server/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function writeFiles() {
const enumFileName = _.kebabCase(field.fieldType);
const enumInfo = utils.buildEnumInfo(field, this.angularAppName, this.packageName, this.clientRootFolder);
this.template(
`${SERVER_NODEJS_DIR}src/domain/enumeration/Enum.ts.ejs`,
`${SERVER_NODEJS_DIR}src/domain/enumeration/enum-type.ts.ejs`,
`${SERVER_NODEJS_DIR}src/domain/enumeration/${enumFileName}.ts`,
this,
{},
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* The <%= enumName %> enumeration.
*/
export enum <%= enumName %> {
<%_ for (idx in enumValues) { _%>
<%= enumValues[idx] %> = '<%= enumValues[idx] %>',
<%_ } _%>
}
3 changes: 2 additions & 1 deletion generators/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,10 @@ function addServiceToAppModule(generator, serviceClass) {
function buildEnumInfo(field, angularAppName, packageName, clientRootFolder) {
const fieldType = field.fieldType;
field.enumInstance = _.lowerFirst(fieldType);

const enumInfo = {
enumName: fieldType,
enumValues: field.fieldValues.split(',').join(', '),
enumValues: field.fieldValues.split(','),
enumInstance: field.enumInstance,
enums: field.fieldValues.replace(/\s/g, '').split(','),
angularAppName,
Expand Down
Loading

0 comments on commit 5172443

Please sign in to comment.