-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[CLI] add lb4 repository
command
#1588
Comments
|
Relates #1359 ? . This feature is complex but needed. It will have to generate the appropriate repository based upon a relationship (if it exists). Perhaps two PRS, a simple one (without relations) first?. Also the controller generator will have to include this relationship! |
Instead of adding a new Prompts to ask:
Depending on the datasource selected, we need to use a different base repository class. For example,
Let's work incrementally please. As I see it, adding a generator for regular (CRUD, non-relational) repositories is a useful feature on its own. Once it done, we can perhaps leverage the implementation to generate relational repositories too. As for the controller generator, our current approach is to have one controller for each relation. For example, when |
I am adding this story to GA scope (at least for consideration). The fact that |
From my user point of view I like both options. Albeit, The
I would like to contribute. |
Cross-posting #1587 (comment) by @virkt25 With LoopBack 4, one of the intentions is to move away from having a Model tied to a DataSource. We should be able to use That said ... maybe this signifies that we eventually need a command to create a series of artifacts together since in most cases you'll want to create a |
In that light, doesn't |
|
Someone working on this?. I would like to get my hands on it. With ALL your help of course 😄 |
No ones picked it up thus far, be more than happy to help as needed :) |
Thanks @virkt25 👍 |
WIP PR close loopbackio#1588
WIP PR close loopbackio#1588
add lb4 repository to the cli integration test implements loopbackio#1588
WIP PR close loopbackio#1588
add lb4 repository to the cli integration test implements loopbackio#1588
add lb4 repository to the cli integration test implements loopbackio#1588
WIP PR close loopbackio#1588
add lb4 repository to the cli integration test implements loopbackio#1588
multiple selection of models to generate multiple repositories implements loopbackio#1588
install a third party package to navigate thru the model class and infer the data type implements loopbackio#1588
WIP PR close loopbackio#1588
add lb4 repository to the cli integration test implements loopbackio#1588
multiple selection of models to generate multiple repositories implements loopbackio#1588
install a third party package to navigate thru the model class and infer the data type implements loopbackio#1588
WIP PR close loopbackio#1588
add lb4 repository to the cli integration test implements loopbackio#1588
multiple selection of models to generate multiple repositories implements loopbackio#1588
install a third party package to navigate thru the model class and infer the data type implements loopbackio#1588
WIP PR close loopbackio#1588
add lb4 repository to the cli integration test implements loopbackio#1588
multiple selection of models to generate multiple repositories implements loopbackio#1588
install a third party package to navigate thru the model class and infer the data type implements loopbackio#1588
WIP PR close loopbackio#1588
add lb4 repository to the cli integration test implements loopbackio#1588
multiple selection of models to generate multiple repositories implements loopbackio#1588
install a third party package to navigate thru the model class and infer the data type implements loopbackio#1588
WIP PR close loopbackio#1588
add lb4 repository to the cli integration test implements loopbackio#1588
multiple selection of models to generate multiple repositories implements loopbackio#1588
install a third party package to navigate thru the model class and infer the data type implements loopbackio#1588
@hacksparrow finally it is closed 👍 |
Thanks @marioestradarosa, this is a very useful feature 🕺🏻 |
Thanks @marioestradarosa. Are you interested in creating a blog post for this feature? If you're publishing in your own blog, please let us know too, we can help spreading the words! |
hi @dhmlau , Sure I will send you the draft first 👍 |
Description / Steps to reproduce / Feature proposal
lb4 repository
command will generate the basic repository file for a given name. It is better than copy-pasting and editing files.Current Behavior
There is no
lb4 repository
command.Expected Behavior
We should have
lb4 repository
command.Acceptance Criteria
lb4 repository
command to@loopback/cli
. Works as follows:DataSource Selection (Detect in project using https://github.com/strongloop/loopback-next/blob/master/packages/cli/lib/utils.js#L210). (Infer binding key based on Boot Conventions).
Detect the type of Repository (DefaultCrudRepository / KVRepository) based on the DataSource (No prompt).
Model Selection (Detect in project using https://github.com/strongloop/loopback-next/blob/master/packages/cli/lib/utils.js#L210). This will be a multiple choice question allowing a user to select multiple models to back to same DataSource. We will generate a new class for each selected model.
Prompt for type of
id
field in Model ... if we can't infer by inspecting theModel
class ourselves (Ex: Check ifid
property exists and set astypeof Todo.prototype.id
in model or check metadata for which field is theid
... if both fail then prompt the user.Use templates to generate the appropriate repository artifact as
/src/repositories/<modelName>.<dataSourceName>repository.ts
--config
mode is supported (Can pass in answers to all prompts using JSON).See Reporting Issues for more tips on writing good issues
The text was updated successfully, but these errors were encountered: