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

enum type values not correctly mapped in the server side #156

Closed
Aragonbn90 opened this issue Aug 2, 2020 · 2 comments
Closed

enum type values not correctly mapped in the server side #156

Aragonbn90 opened this issue Aug 2, 2020 · 2 comments
Labels
bug Something isn't working v1.2.0 1.2.0 Release label
Milestone

Comments

@Aragonbn90
Copy link
Contributor

Describe the bug
Enum type at server side is not set value.

To Reproduce
Steps to reproduce the behavior:

  1. Generate entity with enum column, such as: ONE,TWO,THREE
  2. Start app
  3. Add new record with enum value ONE
  4. See error
    sql error:

Expected behavior
Created record with enum value 'ONE'

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Edge chromium

Caution
file /server/src/domain/enumeration/enum-type.ts done have value. It is:
EnumType { ONE, TWO, THREE }
Then Mysql generate column with value '0', '1', '2'

Solution
change file enum-type.ts to:
'EnumType { ONE = 'ONE', TWO = 'TWO', THREE = 'THREE' }'

@ghost
Copy link

ghost commented Aug 3, 2020

Hi @Aragonbn90 , thanks for the feedback!
So the issue is due to the [template],(https://github.com/jhipster/generator-jhipster-nodejs/blob/master/generators/entity-server/templates/server/src/domain/enumeration/Enum.ts.ejs), we have to replace the enumValues with the literal object as explained in your example.

Maybe we have to generate e2e entity test more useful without entityMock object in test template, that is with real sqlite query. In this way we can check eventual bugs in the test integration pipeline.

Would you fix this issue? As just said, You have to do this step:

  • Fill the enumValues variable with the string list.

For the test task, maybe it is a bit difficult and I could do it in future if for you is complicated. it requires to
Add new programmatically fields without entityMock variable according the entity generated. It will call the service without mock using generated test field type as in java template.

For any questions do not hesitate to ask me! Thanks

@ghost ghost added the bug Something isn't working label Aug 3, 2020
@ghost ghost changed the title enum type at server side enum type values not correctly mapped in the server side Aug 3, 2020
@ghost ghost closed this as completed in 7e2bb2b Aug 5, 2020
@ghost
Copy link

ghost commented Aug 5, 2020

Thanks for the feedback, the bug is been fixed!
screen

ghost pushed a commit that referenced this issue Aug 5, 2020
@ghost ghost self-assigned this Aug 13, 2020
@ghost ghost added this to To do in nodejs blueprint via automation Aug 13, 2020
@ghost ghost added the v1.2.0 1.2.0 Release label label Aug 13, 2020
@ghost ghost moved this from To do to Done in nodejs blueprint Aug 13, 2020
@ghost ghost added this to the 1.2.0 milestone Aug 14, 2020
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v1.2.0 1.2.0 Release label
Projects
Development

No branches or pull requests

1 participant