Ejemplo n.º 1
0
  verifyExpires: {
    type: Number,
    default: false
  },
  resetToken: {
    type: String,
    default: false
  },
  resetExpires: {
    type: Number,
    default: false
  },

  role: {
    type: String,
    default: 'basic',
    validate: validators.matches(patterns.isTitle)
  },
  enabled: {
    type: Boolean,
    default: true
  },

  createdAt: { type: Date, 'default': Date.now },
  updatedAt: { type: Date, 'default': Date.now }
});

const userModel = mongoose.model('user', userSchema);

module.exports = userModel;
Ejemplo n.º 2
0
 */


var supplierSchema = new Schema({
    /** unique id for supplier and should be alphanumeric and maximum 30 characters */
    supplierId: { type: String, validate: [validator.isAlphanumeric(), validator.isLength(2, 30)] },
    /** reference to Tennant Collection and should save id of Tenant and is the required field */
    tenantRef: { type: String, ref: 'tenant', index: true , required: true  },
    /** Id which supplier see and is the combination of tenantRef and supplierId */
    supplierDisplayId: {type: String, index: true },
     /** reference to supplierGroup Collection and should save id of supplierGroup and is required */
    supplierGroup: { type: String, ref: 'supplierGroup' ,required: true},
    /** nine digit number required for doing business in Europe, US and many other country */
    dunsNo: { type: String, validate: [validator.isLength(0, 9)] },
    /** name of supplier and should be alphaNumeric, between 2 to 30 characters  */
    supplierName: { type: String, validate: [validator.isLength(2, 30),  validator.matches(/^[a-zA-Z0-9\s]+$/)] },
    /** is alphabet and can be maximum 10 characters */
    status: { type: String , validate:[validator.isAlpha(), validator.isLength(0, 10)]},
    /** is string type and can be maximum 50 characters */
    termsOfPayment: { type: String , validate:[ validator.isLength(0, 50)]},
    /** is string type and can be maximum 50 characters */
    termsOfDelivery: { type: String , validate:[ validator.isLength(0, 50)]},
    /** is string type and can be maximum 50 characters */
    methodOfPayment: { type: String , validate:[validator.isLength(0, 50)]},
    /** is string type and can be maximum 50 characters */
    taxIdentificationNo: { type: String, validate:[validator.isLength(0, 50)] },
    /** is string type and can be maximum 50 characters */
    extSupplierID: { type: String, validate:[validator.isLength(0, 50)] },
    /** is string type and can be maximum 50 characters */
    accountNumber: { type: String, validate:[validator.isLength(0, 50)] },
    /** A BIC/SWIFT code is used to identify individual banks around the world. BIC and SWIFT code are interchangeable terms meaning the same thing, and can be maximum 11 characters */
Ejemplo n.º 3
0
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const patterns = require('../../components/patterns');
const validators = require('mongoose-validators');

const extensionsSchema = new Schema({
  label: {
    type: String,
    required: true,
    trim: true
  },
  html: {
    type: String,
    required: true,
    validate: validators.matches(patterns.isFilePath)
  },
  folder: {
    type: String,
    required: true,
    validate: validators.matches(patterns.isFilePath)
  },
  contents: {
    type: String,
    required: true,
    validate: validators.matches(patterns.isFilePath)
  },
  screenshot: {
    type: String,
    required: false,
    validate: validators.matches(patterns.isFilePath, {skipEmpty: true})
Ejemplo n.º 4
0
var  validator = require('mongoose-validators');

/**
 * @class businessPartner 
 * @classdesc businessPartner class contains the details of business partner
 */


var businessPartner = {
        /** is of string type */
        extAccountCode: { type: String },
        /** external name for business partner and should be alphaNumeric, minimum 2 characters and maximum 30 characters */
        extName: { type: String, validate:[validator.isLength(2, 30), validator.matches(/^[a-zA-Z0-9_-\s]+$/)] },
        /** external short name should be alphaNumeric and in between 2 to 30 characters */
        extShortName: { type: String, validate:[validator.isLength(2, 30), validator.matches(/^[a-zA-Z0-9_-\s]+$/)] },
        /** external global id should be alphaNumeric and in between 2 to 40 characters */
        extGlobalId: { type: String, validate:[validator.isLength(2, 40), validator.matches(/^[a-zA-Z0-9\s]+$/)] },
        /** is of string type and can be maximum 40 characters */
        language: { type: String , validate:[validator.isLength(0, 40)] },
        /** is of string type and can be maximum 20 characters */
        currency: { type: String, validate:[validator.isLength(0, 20)]},
        /** contains the file name of logo*/
        logo: { type: String }
};

module.exports = {
    BusinessPartner: businessPartner
};
Ejemplo n.º 5
0
var mongoose = require('mongoose'),
    Schema = mongoose.Schema,
    constants = require('../Utility/constants').constants,
    validator = require('mongoose-validators');


var VariantSchema = new Schema({

    /**
     * Id for varient.
     */
    variantId: {
        type: String,
        unique: true,
        required: true,
        validate: [ validator.matches(constants.idRegex), validator.isLength(0, 50) ]
    },

    /**
     * Identifier of list of product attribute.
     */
    attributes: [{
        type: String
    }],


    /**
     * Is used to decide whether varient need new Classification Group for a product.
     * Default selection is false.
     */
    hasVariantClassificationGroupAssociations: {
Ejemplo n.º 6
0
'use strict';

var mongoose = require('mongoose'),
    Schema = mongoose.Schema,
    patterns = require('../../components/patterns'),
    validators = require('mongoose-validators');

var ExtensionSchema = new Schema({
  name: {
    type: String,
    required: true,
    trim: true,
    validate: validators.matches(patterns.isTitle)
  },
  folderName: {
    type: String,
    required: true,
    validate: validators.matches(patterns.isFilePath)
  },
  urls: [{
    type: String,
    required: false,
    validate: validators.matches(patterns.isURI, {skipEmpty: true})
  }],
  screenshot: {
    type: String,
    required: false,
    validate: validators.matches(patterns.isFilePath, {skipEmpty: true})
  },
  config: Schema.Types.Mixed,
  data: Schema.Types.Mixed,