pl4y-data-library
Version:
This library contains the dtos, enums, schemas, and other data objects needed in the pl4y ecosystem.
36 lines • 1.1 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.VendorSchema = void 0;
const mongoose_1 = require("mongoose");
exports.VendorSchema = new mongoose_1.Schema({
businessName: {
type: String,
required: [true, "Business name is required"],
minlength: [3, "Business name must be at least 3 characters long"],
maxlength: [100, "Business name must not exceed 100 characters"],
},
email: {
type: String,
match: [/^\S+@\S+\.\S+$/, "Email must be a valid email address"],
},
phone: {
type: String,
match: [/^\d{10,15}$/, "Phone number must be between 10 and 15 digits"],
},
products: {
type: [String],
},
website: {
type: String,
match: [/^https?:\/\/[^\s/$.?#].[^\s]*$/, "Website must be a valid URL"],
},
rating: {
type: Number,
min: [1, "Rating must be at least 1"],
max: [5, "Rating must not exceed 5"],
},
}, {
timestamps: true,
collection: "vendors",
});
//# sourceMappingURL=vendor.schema.js.map