Skip to content

One line keys #23

Description

@khattakdev

To add Keys users have to input the number of keys he wants in the schema and then give detail of each key

$ msc
? Please input Schema name user
? How many key this Schema has? 1
? Please input Schema Key name username
? Please input Schema Key type String
? Is this Schema Key Required Yes
? What is the default value? Arsalan

There should be an argument --oneline which will add all the schema's key in just one line.

$ msc --online
? Please input Schema name user
? Please add all the key's name: firstname lastname username email

Which will generate the following schema Object

const userSchema = new Schema({
  firstname: {
    type: String,
    required: true,
    default: "",
  },
  lastname: {
    type: String,
    required: true,
    default: "",
  },
  username: {
    type: String,
    required: true,
    default: "",
  },
  email: {
    type: String,
    required: true,
    default: "",
  },
  
  timestamps: { createdAt: "created_at", updatedAt: "updated_at" },
});

This will not ask for any details but key's name only. User can then change the schemas from file manually.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cliAnything that is related to command line such as inputs and arguments

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions