DEV Community

Ayoub Touba
Ayoub Touba

Posted on • Originally published at blog.yaffalab.com on

Announcing Version 2.0 of nestjs-DbValidator

We are excited to unveil version 2.0 of nestjs-DbValidator, a feature-packed module providing custom database validators using class-validator and typeorm for Nest.js applications. This latest release comes with an array of enhancements, new features, and bug fixes, making it even more versatile and compatible with the latest Nest.js versions.

What's New in Version 2.0

  1. Custom Type Support In version 2.0, we introduce the ability to customize the type of the column for validation. Now you can specify the type using the customType parameter, allowing for more flexibility in handling different data types.
@isExistDb({ table: 'user', column: 'firstName', customType: TYPECOLUMN.STRING })idcities: any;
Enter fullscreen mode Exit fullscreen mode

2. Nest.js 9 and Above Compatibility We are excited to announce that nestjs-DbValidator has been upgraded to support Nest.js version 9 and above. This ensures seamless integration with the latest features and improvements introduced in the Nest.js framework. Thanks to @DevDeNiro for their significant contribution in the upgrade.

To upgrade to version 2.0, simply update your package using the following command:

Getting Started with Version 2.0

npm update @youba/nestjs-dbvalidator# oryarn upgrade @youba/nestjs-dbvalidator
Enter fullscreen mode Exit fullscreen mode

After updating, be sure to check the documentation for any additional configuration changes and new features introduced in this release.

A Brief Review of nestjs-DbValidator

Overview

nestjs-DbValidator is a Nest.js module that simplifies database validation in your applications. It leverages the power of class-validator and typeorm to offer a seamless and intuitive way to validate data against your database.

Key Features

isExistDb : Checks if a value already exists in the specified table and column. isUniqueDb : Verifies if a value is unique within the specified table and column. isLowerDb : Validates if a value is lower, useful for scenarios such as checking client credits.

isBiggerDb : Validates if a value is bigger, suitable for cases like checking stock levels.

Easy Integration

The library is easy to integrate into your Nest.js application. By adding a few lines of code, you can enhance the validation capabilities of your DTOs and entities.

Version 2.0 Improvements Version 2.0 builds upon the success of the previous release by introducing custom-type support and ensuring compatibility with Nest.js 9 and above.

Conclusion

Feel free to provide feedback, report issues, or contribute to the project on GitHub.

Happy coding!

Top comments (0)