burm icon indicating copy to clipboard operation
burm copied to clipboard

EASY: Add property names to the Model object

Open William-McGonagle opened this issue 1 year ago • 2 comments

Currently, in the model object schema, there are some properties like hasParameter (function), name (string), and parameters (object). I think it would be cool that in the file where we create the model object, we also add in the columns that the user defined for the model.

You might be wondering what the use case for this would be, but it would be mainly used for what I'm going to show below. Using this below could make the code much more readable and simple to understand, but in the end, User.id would also have the value of "id", so the two would be identical in function.

const userData = User.findOne({
    where: Condition.Equals("id", 1)
})

Turns into

const userData = User.findOne({
    where: Condition.Equals(User.id, 1)
})

William-McGonagle avatar Jul 20 '22 10:07 William-McGonagle

Hey, William. I can do this change as you mentioned above.

Deepu178 avatar Jul 23 '22 12:07 Deepu178

Sounds good @Deepu178!

William-McGonagle avatar Jul 23 '22 20:07 William-McGonagle