import mongoose from "mongoose"; const { Schema, model } = mongoose; const productSchema = new Schema( { SKU: { type: String, required: [true, "Please Enter product SKU"], unique: true, trim: true, }, name: { type: String, maxLength: [35, "name cannot exceed 25 characters"], required: [true, "Please Enter product Name"], trim: true, }, category: { type: Schema.Types.ObjectId, ref: "CategoryModel", }, brand: { type: Schema.Types.ObjectId, ref: "BrandModel", }, price: { type: Number, required: true, }, GST: { type: Number, required: true, }, HSN_Code: { type: Number, required: true, }, description: { type: String, maxLength: [400, "description cannot exceed 100 characters"], // required: [true, "Please Enter product Description"], }, image: [ { public_id: { type: String, // required: true, }, url: { type: String, // required: true, }, }, ], product_Status: { type: String, enum: ["Active", "inActive"], default: "Active", }, addedBy: { type: Schema.Types.ObjectId, required: true, ref: "User", }, }, { timestamps: true } ); export const Product = model("Product", productSchema);