Skip to content

[CLI] Generate model #1221

@dhmlau

Description

@dhmlau

Description / Feature proposal

CLI command to generate model TS file.

Outstanding questions

  • Do we ask the user to select the base class? If yes, what are the selections? or it will always be Entity.
  • What are the property types we support? Here is what we have in LB3:
    string
    number
    boolean
    object
    array
    date
    buffer

Acceptance Criteria

  • Make a CLI prompt for model and its properties
    • For properties, ask for their name, their types and their default values
  • The produced model should extend from Entity

User Experience

$ lb4 model
? Enter the model name: Customer
Let's add some Customer properties now. 

Enter an empty property name when done.
? Property name: customerId
? Property type:  (show a list of available types) string
? Required? (y/N) y
? Default value[leave blank for none]:

Let's add another Customer property.
Enter an empty property name when done.
? Property name: name
? Property type:  (show a list of available types) string
? Required? (y/N) y
? Default value[leave blank for none]:

At the end, src/models/customer.model.ts will be created.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions