evoluteur / evolutility-server-node

Model-driven REST APIs for CRUD and more, written in Javascript, using Node.js, Express, and PostgreSQL.
GNU Affero General Public License v3.0
112 stars 33 forks source link

Replacing ID with other column name in all scripts [Not an issue] #22

Closed pymeup closed 5 years ago

pymeup commented 5 years ago

Hi Olivier,

Hope to find you well!

During my testing of the Evolutility Server Node (+ React) apps I found that the field "ID" is used across your solution as a hardcoded parameter (example crud.js) and came to the conclusion that if this column is missing from my dataset the scripts will fail.

One solution would be just to add the column in my table and it will work (with some tweaks). But in a scenario where I do not know the structure of the incoming tables, where some may or may not contain this column or where "ID" is not unique I would like to be able to change the name of the column from "ID" to, lets say, "Evol_ID". Unfortunately, I have failed to do this, mostly because Evol_ID will be part of the sql statement and just replacing "ID" with "Evol_ID" in the scripts will not be enough.

Having this in mind, have you encountered this type of problem so far? Maybe there is an workaround for this? If not, is it possible to take this into consideration for future releases (maybe as a global parameter)?

Looking forward to hearing from you!

Best, Costin V.

evoluteur commented 5 years ago

Hi Costin,

Done. I just added a new model property called "pkey" to specify the name of the column used as primary key. It is still called id in the data (so that nothing change UI-side).

Enjoy, Olivier

david-pfx commented 5 years ago

But can it have a non-integer value? That has an impact on the API.

evoluteur commented 5 years ago

Only integer value and no surrogate keys for now.

pymeup commented 5 years ago

Hi all,

Works now, thank you!

One more suggestion: is it possible to make c_date and u_date optional fields? I know in a previous version they were not mandatory.

Thanks, Costin

Sent with ProtonMail Secure Email.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Sunday, February 17, 2019 1:11 PM, Olivier Giulieri notifications@github.com wrote:

Only integer value for now.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

evoluteur commented 5 years ago

Cool. c_date and u_date are already optional. Just set "wTimestamp: false" and "wWhoIs: false" in config.js.

pymeup commented 5 years ago

Hi Olivier, David

Many thanks for the latest updates and fast response!

I'm coming back to David suggestion, to have this field as a string instead of a integer. Do you think that is possible to have this feature in the near future?

Concatenating multiple integer fields does not seem a reliable solution given a very big dataset.

Looking forward to your answer!

Thank you, Costin V.

Sent with ProtonMail Secure Email.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Sunday, February 17, 2019 11:34 PM, Olivier Giulieri notifications@github.com wrote:

Cool. c_date and u_date are already optional. Just set "wTimestamp: false" and "wWhoIs: false" in config.js.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.