DEV Community

Cover image for Day-47 Training At Ryaz
mahin651
mahin651

Posted on

Day-47 Training At Ryaz

Date:21/03/2022
Day:Monday

Today's started at about 10:40 am as I was done with creating the course.js file so, the naming conventions, various inputs like: auto,price,category,date etc were declared inside the create course so, as we done want messy and inappropriate data would be added by the user sower were supposed to use validators as we have various validators like built-in validation ,custom validation, Async-validation ,so, we use this validators according to our ease like in name attribute I used the required ti true and set bot minimum length and maximum length as if the user enter more or less than certain limit he would receive error. and after this in category attribute I declared the enum list so, that user would only select from given list if user would add beyond it so, he would receive the error and in tags attribute I used asynchronous validate as user have to specify at least one tag otherwise the error would be reflected and In price attribute I declared custom validator as I declared the min and max cost of course and if user would add the price of course as 70.6 it would be rounded off to 80 so, this would help to normalise the cost of course.so, this way my day ended up.

Top comments (0)