-
Notifications
You must be signed in to change notification settings - Fork 365
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
sync JavaScript enums with PostgreSQL #562
Comments
Hello! Can I create a folder named "shared" which contains meterTypes.js and meterTypes.ts, which can export the type nums. Then I import one in src/client/app/types/redux/meters.ts , and import another in src/server/models/Meter.js? Since the two meterTypes file are in one folder, poeple will probably remember to keep them in sync. |
@RuxueJ Thanks for this idea. It is probably an improvement but I would like to see if there is a way to automatically keep the JS and TS in sync. If not, we could do what you suggest. Also, this does not seme to address the direct issue of making the Postgres enums match the TS/JS ones. Any thoughts on that? |
My team and I would Like to work on this issue. |
@DPJProgramming Thanks for wanting to work on this. I'm not sure how to make this work and I hope you can come up with ideas. I'm also happy to help as needed. |
Hello! We've (@DPJProgramming, @dalejk88, @EBoyd3443, @Gballreich) set up an initial test case for checking JS objects to SQL enums: |
Thanks to @DPJProgramming, @dalejk88, @EBoyd3443, @Gballreich for working on this. I have not run the code to check it but it seems good. Here are a few thoughts:
so it might be best to do that.
|
Hi Huss,
Line 232 in 82a74d6
These two do not equate. We've written the test for them, but wanted to double check that they should equate and if we should make any changes outside our tests when submitting the pull request. |
Well, this is an example of how testing can help find issues. Good catch and thanks for asking. I searched the code and Unit.AREA does not seem to be used. It has been a while but I think that is a remnant of the idea that area would be calculated on the server and use the unit concept. Instead, OED does the calculation on the client. So, Unit.AREA should be removed from the Object. Let me know if this causes any issues. |
Currently we have an open pull request to create tests for keeping DB Enums in sync with the JS objects link here What we tried to address the TS Enum tests:
After speaking with @huss 12.04.24 our team has come to the conclusion of:
|
As stated, I concur to close this issue. If anyone has ideas on how to check the TS enums then that would be welcome. When OED fully converts to TS then the tests for the JS objects that are logically enums should be converted to check the TS enums. The current client only enums could be compared to the DB ones. It is also assumed that a single enum will exist for the client and server. |
Tests JS objects and DB Enums in sync for Issue #562
In our PostgreSQL database, we use enums for meter types. We also supply logical names for these types as an enum in the Meter class. These two enums need to be kept in sync, i.e. if we make changes to either one these enums in the future, we need to remember to change the other.
The text was updated successfully, but these errors were encountered: