Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const types = require('mongoose').SchemaTypes;
module.exports = {
// Mongoose specific
String: types.String,
Number: types.Number,
Boolean: types.Boolean,
DocumentArray: types.DocumentArray,
Embedded: types.Embedded,
Array: types.Array,
Buffer: types.Buffer,
Date: types.Date,
ObjectId: types.ObjectId,
Mixed: types.Mixed,
Decimal128: types.Decimal128,
Object: types.Mixed,
Bool: types.Boolean,
// Sequelize specific
STRING: types.String,
CHAR: types.String,
TEXT: types.String,
TINYINT: types.Number,
SMALLINT: types.Number,
MEDIUMINT: types.Number,
INTEGER: types.Number,
BIGINT: types.Number,
NUMBER: types.Number,
FLOAT: types.Number,
import { Schema, SchemaTypes as t } from "mongoose";
import { utils } from "nestx-common";
const { transform } = utils;
export const GroupSchema = new Schema(
{
outid: { type: t.Number },
name: { type: t.String },
icon: { type: t.String },
isRegion: { type: t.Boolean },
order: { type: t.Number },
parent: { type: t.ObjectId, ref: "Group" },
paths: [{ type: t.ObjectId, ref: "Group" }],
director: { type: t.ObjectId, ref: "User" },
description: { type: t.String }
},
{ timestamps: true }
);
GroupSchema.set("toJSON", {
transform
});
import { Schema, SchemaTypes as t } from "mongoose";
import { utils } from "nestx-common";
const { transform } = utils;
export const GroupSchema = new Schema(
{
outid: { type: t.Number },
name: { type: t.String },
icon: { type: t.String },
isRegion: { type: t.Boolean },
order: { type: t.Number },
parent: { type: t.ObjectId, ref: "Group" },
paths: [{ type: t.ObjectId, ref: "Group" }],
director: { type: t.ObjectId, ref: "User" },
description: { type: t.String }
},
{ timestamps: true }
);
GroupSchema.set("toJSON", {
transform
});
import { Schema, SchemaTypes as t, SchemaOptions, model } from 'mongoose';
export const schema = new Schema({
name: t.String,
article: { ref: 'Article', type: t.ObjectId },
text: t.String,
},
{ timestamps: true });
type: t.String,
mobile: { type: t.String, unique: true, required: true },
roles: [
{
type: t.ObjectId,
ref: 'Role',
},
],
groups: [
{
type: t.ObjectId,
ref: 'Group',
},
],
profile: {
type: t.ObjectId,
ref: 'Profile',
},
isDisable: {
type: t.Boolean,
},
isAdmin: {
type: t.Boolean,
},
isApproved: {
type: t.Boolean,
},
expired: {
type: t.Date,
},
},
{
import { Schema, SchemaTypes as t, SchemaOptions } from "mongoose";
import { utils } from "nestx-common";
const { transform } = utils;
const option: SchemaOptions = {};
option.timestamps = true;
export const RoleSchema = new Schema(
{
name: { type: t.String },
description: { type: t.String },
permissions: [{ type: t.ObjectId, ref: "Menu" }]
},
option
);
RoleSchema.set("toJSON", {
transform
});
const option: SchemaOptions = {};
option.timestamps = true;
export const PageSchema = new Schema(
{
name: { type: t.String },
title: t.String,
keyword: t.String,
description: t.String,
sort: t.Number,
disable: t.Boolean,
publish: { type: t.Date, default: Date.now },
meta: {
ref: 'Meta',
type: t.ObjectId,
},
content: {
ref: 'Content',
type: t.ObjectId,
},
template: {
ref: 'Content',
type: t.ObjectId,
},
},
option,
);
PageSchema.set('toJSON', {
transform,
});
import { Schema, SchemaTypes as t } from 'mongoose';
import { transform } from './../../utils';
export const GroupSchema = new Schema(
{
outid: { type: t.Number },
name: { type: t.String },
icon: { type: t.String },
isRegion: { type: t.Boolean },
order: { type: t.Number },
parent: { type: t.ObjectId, ref: 'Group' },
paths: [{ type: t.ObjectId, ref: 'Group' }],
director: { type: t.ObjectId, ref: 'User' },
description: { type: t.String },
},
{ timestamps: true },
);
GroupSchema.set('toJSON', {
transform,
});
enable: { type: t.Boolean },
expanded: { type: t.Boolean },
acl: { type: t.String },
paths: [
{
type: t.ObjectId,
ref: 'Menu',
},
],
parent: {
type: t.ObjectId,
ref: 'Menu',
},
permissions: [
{
type: t.ObjectId,
ref: 'Menu',
},
],
isMenu: {
type: t.Boolean,
default: true,
},
},
option,
);
MenuSchema.set('toJSON', {
transform,
});
icon: { type: t.String },
order: { type: t.Number, default: 100 },
enable: { type: t.Boolean },
expanded: { type: t.Boolean },
acl: { type: t.String },
paths: [{
type: t.ObjectId,
ref: 'Menu'
}],
parent: {
type: t.ObjectId,
ref: 'Menu'
},
permissions: [
{
type: t.ObjectId,
ref: 'Menu'
}
],
isMenu: {
type: t.Boolean,
default: true
}
}, option);