-
Notifications
You must be signed in to change notification settings - Fork 590
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 scaffolding - "New model" #741
Comments
The only thing I'm questioning now... how should these models be wired with the GraphQL plugins? Currently, the user will have to do it by himself. Should we offer a wiring option to the user? For example, we could ask him if he'd like we create basic GraphQL CRUD fields? |
Some feedback from me:
If the scaffolding template for the whole So my idea is to generate the entire skeleton for the apollo service, including the
|
|
Please reopen this issue once you add more information and updates here. If this is not the case and you need some help, feel free to seek help from our Slack Community or ping one of the reviewers. Thank you for your contributions! |
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This is:
Detailed Description
This is an extension of issue #733. It defines a new scaffolding template - "New model".
Basically, we need a new scaffolding template, which will enable users to immediately jump into defining their data models, without doing the repetitive initial setup.
So basically, the user selects the template, and enters the name of the model. I think for v1 this should be more than enough, but feel free to add anything if needed.
The folder that the template creates might look like this:
![image](https://user-images.githubusercontent.com/5121148/75902172-ec61bb80-5e3f-11ea-80a8-e86d514774ac.png)
The contents of files
api/pets/src/models/pet.model.ts
:api/pets/src/models/trick.model.ts
:api/pets/src/models/index.ts
:And finally, the
api/pets/src/models.ts
:##### Notes
If
api/pets/src/models.ts
already exists, the scaffolding template should be smart enough to amend it. The same goes forapi/pets/src/models/index.ts
I'm not sure about the
api/pets/src/index.ts
, should the tool import and add the plugins there too? Or should the user do this manually? An example:Other actions
Except for the files above, there are a few other actions the scaffolding template must take.
It must add this plugin:
![image](https://user-images.githubusercontent.com/5121148/75904272-2ed8c780-5e43-11ea-84a3-90d336c01c97.png)
So the snippet is:
This is required because it puts a configured Commodo driver into the
graphql
context. In other words, because of this plugin, we can doconst driver = context.commodo && context.commodo.driver;
inapi/pets/src/models.ts
.I realize that this is hard-coding the
db-proxy
driver. Maybe it's enough for this stage? Later we can ask the user which driver he wants to use and generate needed resources in the serverless.yml.And that's it basically. We'll see along the way if something is missing. There are a few things we could, of course, improve here, for example, ask the user which fields he'd like to immediately insert into the new model. But I think it's not super important at this stage. Feel free to leave your thoughts.
The text was updated successfully, but these errors were encountered: