Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const mongoose = require('mongoose');
const bcrypt = require('bcryptjs');
const mongooseTypes = require('mongoose-types');
// Loads into Mongoose Schema Types
mongooseTypes.loadTypes(mongoose, 'email');
const { Schema } = mongoose;
const { ObjectId } = Schema.Types;
const { Email } = mongoose.SchemaTypes;
const Employee = new Schema({
name: {
type: String,
required: true,
},
password: {
type: String,
required: true,
},
pin: {
type: String,
required: true,
min: 4,
max: 4,
},
if (passedAllowBlank && !required) {
return true
}
return regEmail.test(val)
}
function Email (path, options) {
this.options = options;
this.path = path;
mongoose.SchemaTypes.String.call(this, path, options)
this.validate(function (val) { return validateEmail(val, options) }, options.message || Email.defaults.message || 'invalid email address')
}
Email.defaults = {}
Object.setPrototypeOf(Email.prototype, mongoose.SchemaTypes.String.prototype)
Email.prototype.cast = function (val) {
return val.toLowerCase()
}
Email.prototype.get = function (val) {
return val.toLowerCase()
}
Email.prototype.checkRequired = function (val) {
return typeof val === 'string' && validateEmail(val, this.options);
};
mongoose.SchemaTypes.Email = module.exports = Email
mongoose.Types.Email = String
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const mongoose_1 = require("mongoose");
exports.schema = new mongoose_1.Schema({
outid: { type: mongoose_1.SchemaTypes.Number },
name: { type: mongoose_1.SchemaTypes.String },
icon: { type: mongoose_1.SchemaTypes.String },
isRegion: { type: mongoose_1.SchemaTypes.Boolean },
order: { type: mongoose_1.SchemaTypes.Number },
parent: { type: mongoose_1.SchemaTypes.ObjectId, ref: 'Group' },
paths: [{ type: mongoose_1.SchemaTypes.ObjectId, ref: 'Group' }],
director: { type: mongoose_1.SchemaTypes.ObjectId, ref: 'Account' },
description: { type: mongoose_1.SchemaTypes.String }
}, { timestamps: true });
//# sourceMappingURL=group.schema.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const mongoose_1 = require("mongoose");
exports.schema = new mongoose_1.Schema({
name: { type: mongoose_1.SchemaTypes.String },
title: mongoose_1.SchemaTypes.String,
keyword: mongoose_1.SchemaTypes.String,
description: mongoose_1.SchemaTypes.String,
author: mongoose_1.SchemaTypes.String,
sort: mongoose_1.SchemaTypes.Number,
disable: mongoose_1.SchemaTypes.Boolean,
category: {
ref: 'Category', type: mongoose_1.SchemaTypes.ObjectId
},
meta: {
ref: 'Meta', type: mongoose_1.SchemaTypes.ObjectId
},
content: {
ref: 'Content', type: mongoose_1.SchemaTypes.ObjectId,
},
template: {
function Url (path, options) {
mongoose.SchemaTypes.String.call(this, path, options)
this.validate(validateUrl, 'url is invalid')
}
const mongoose = require('mongoose')
const MeetupSchema = new mongoose.Schema({
name: String,
location: String,
attendees: [{
type: mongoose.SchemaTypes.ObjectId,
ref: 'Person',
autopopulate: {
maxDepth: 1
}
}]
})
MeetupSchema.plugin(require('mongoose-autopopulate'))
const MeetupModel = mongoose.model('Meetup', MeetupSchema)
module.exports = MeetupModel
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const mongoose_1 = require("mongoose");
exports.schema = new mongoose_1.Schema({
name: { type: mongoose_1.SchemaTypes.String },
slug: { type: mongoose_1.SchemaTypes.String },
group: { type: mongoose_1.SchemaTypes.Boolean },
link: { type: mongoose_1.SchemaTypes.String },
externalLink: { type: mongoose_1.SchemaTypes.String },
blank: { type: mongoose_1.SchemaTypes.Boolean },
icon: { type: mongoose_1.SchemaTypes.String },
order: { type: mongoose_1.SchemaTypes.Number, default: 100 },
enable: { type: mongoose_1.SchemaTypes.Boolean },
expanded: { type: mongoose_1.SchemaTypes.Boolean },
acl: { type: mongoose_1.SchemaTypes.String },
paths: [{
type: mongoose_1.SchemaTypes.ObjectId,
ref: 'Menu'
}],
parent: {
type: mongoose_1.SchemaTypes.ObjectId,
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const mongoose_1 = require("mongoose");
exports.schema = new mongoose_1.Schema({
name: {
type: mongoose_1.SchemaTypes.String
},
key: {
type: mongoose_1.SchemaTypes.String
},
value: {
type: mongoose_1.SchemaTypes.Mixed
},
description: {
type: mongoose_1.SchemaTypes.String
}
}, { timestamps: true });
//# sourceMappingURL=setting.schema.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const mongoose_1 = require("mongoose");
exports.schema = new mongoose_1.Schema({
name: {
type: mongoose_1.SchemaTypes.String
},
operator: {
type: mongoose_1.SchemaTypes.String
},
operatorIp: {
type: mongoose_1.SchemaTypes.String
},
operation: {
type: mongoose_1.SchemaTypes.String
},
comment: {
type: mongoose_1.SchemaTypes.String
},
created: {
type: mongoose_1.SchemaTypes.Date,
default: Date.now
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const mongoose_1 = require("mongoose");
exports.schema = new mongoose_1.Schema({
username: mongoose_1.SchemaTypes.String,
password: mongoose_1.SchemaTypes.String,
avatar: mongoose_1.SchemaTypes.String,
email: mongoose_1.SchemaTypes.String,
nick: mongoose_1.SchemaTypes.String,
type: mongoose_1.SchemaTypes.String,
mobile: mongoose_1.SchemaTypes.String,
roles: [{
type: mongoose_1.SchemaTypes.ObjectId, ref: 'Role'
}],
isDisable: {
type: mongoose_1.SchemaTypes.Boolean
},
isAdmin: {
type: mongoose_1.SchemaTypes.Boolean
},
isApproved: {
type: mongoose_1.SchemaTypes.Boolean
},
expired: {