From 3c6f0cadcec7e6626dfa4ceec45e5cc5ef9e554b Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 9 Dec 2025 16:52:50 +0530 Subject: [PATCH] Product create and update validation added --- app/models/product.model.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/models/product.model.js b/app/models/product.model.js index cebbe07..39d6c7d 100644 --- a/app/models/product.model.js +++ b/app/models/product.model.js @@ -14,10 +14,20 @@ module.exports = (sequelize, DataTypes) => { type: DataTypes.INTEGER, allowNull: true, unique: true, + validate: { + len: { + args: [0, 10], + msg: "Invalid HS Code: maximum length is 10 digits." + }} }, hs_description: { type: DataTypes.TEXT, allowNull: true, + validate: { + len: { + args: [0, 1000], + msg: "HS Description is too long. Maximum allowed length is 1000 characters." + }} }, unit_id: { type: DataTypes.INTEGER,