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

Add Support for Custom Primary Key in Templates #3344

Closed
1 task done
nabdelgadir opened this issue Jul 12, 2019 · 0 comments · Fixed by #3347
Closed
1 task done

Add Support for Custom Primary Key in Templates #3344

nabdelgadir opened this issue Jul 12, 2019 · 0 comments · Fixed by #3347
Assignees

Comments

@nabdelgadir
Copy link
Contributor

nabdelgadir commented Jul 12, 2019

Cross-posting from #3297 (comment):

AFAICT, lb4 model does allow users to create a primary key property with a different name than id.

Example prompts & answers to use pk instead of id:

Model Product will be created in src/models/product.model.ts

Let's add a property to Product
Enter an empty property name when done

? Enter the property name: pk
? Property type: string
? Is pk the ID property? Yes
? Is it required?: No
? Default value [leave blank for none]:

Now that #3297 is landed, the id property is excluded when making a POST request. However, the Controller and HasMany templates assume it's always called id.

Acceptance criteria

  • Modify Controller and HasMany templates to include support for custom primary keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant