import {getManager} from"typeorm";import {validate} from"class-validator";let post =newPost();post.title ="Hello"; // should not passpost.text ="this is a great post about hell world"; // should not passpost.rating =11; // should not passpost.email ="google.com"; // should not passpost.site ="googlecom"; // should not passconsterrors=awaitvalidate(post);if (errors.length>0) {thrownewError(`Validation failed!`); } else {awaitgetManager().save(post);}