Removed Search-Index and LokiJS, replaced with Mongo + Updated VueJs
This commit is contained in:
54
models/db/entry.js
Normal file
54
models/db/entry.js
Normal file
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
|
||||
const modb = require('mongoose'),
|
||||
Promise = require('bluebird'),
|
||||
_ = require('lodash');
|
||||
|
||||
/**
|
||||
* Entry schema
|
||||
*
|
||||
* @type {<Mongoose.Schema>}
|
||||
*/
|
||||
var entrySchema = modb.Schema({
|
||||
|
||||
_id: String,
|
||||
|
||||
title: {
|
||||
type: String,
|
||||
required: true,
|
||||
minlength: 2
|
||||
},
|
||||
subtitle: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
parent: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
content: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
|
||||
},
|
||||
{
|
||||
timestamps: {}
|
||||
});
|
||||
|
||||
entrySchema.index({
|
||||
_id: 'text',
|
||||
title: 'text',
|
||||
subtitle: 'text',
|
||||
content: 'text'
|
||||
}, {
|
||||
weights: {
|
||||
_id: 3,
|
||||
title: 10,
|
||||
subtitle: 5,
|
||||
content: 1
|
||||
},
|
||||
name: 'EntriesTextIndex'
|
||||
});
|
||||
|
||||
module.exports = modb.model('Entry', entrySchema);
|
51
models/db/upl-file.js
Normal file
51
models/db/upl-file.js
Normal file
@@ -0,0 +1,51 @@
|
||||
"use strict";
|
||||
|
||||
const modb = require('mongoose'),
|
||||
Promise = require('bluebird'),
|
||||
_ = require('lodash');
|
||||
|
||||
/**
|
||||
* Upload File schema
|
||||
*
|
||||
* @type {<Mongoose.Schema>}
|
||||
*/
|
||||
var uplFileSchema = modb.Schema({
|
||||
|
||||
_id: String,
|
||||
|
||||
category: {
|
||||
type: String,
|
||||
required: true,
|
||||
default: 'binary'
|
||||
},
|
||||
mime: {
|
||||
type: String,
|
||||
required: true,
|
||||
default: 'application/octet-stream'
|
||||
},
|
||||
extra: {
|
||||
type: Object
|
||||
},
|
||||
folder: {
|
||||
type: String,
|
||||
ref: 'UplFolder'
|
||||
},
|
||||
filename: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
basename: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
filesize: {
|
||||
type: Number,
|
||||
required: true
|
||||
}
|
||||
|
||||
},
|
||||
{
|
||||
timestamps: {}
|
||||
});
|
||||
|
||||
module.exports = modb.model('UplFile', uplFileSchema);
|
23
models/db/upl-folder.js
Normal file
23
models/db/upl-folder.js
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
|
||||
const modb = require('mongoose'),
|
||||
Promise = require('bluebird'),
|
||||
_ = require('lodash');
|
||||
|
||||
/**
|
||||
* Upload Folder schema
|
||||
*
|
||||
* @type {<Mongoose.Schema>}
|
||||
*/
|
||||
var uplFolderSchema = modb.Schema({
|
||||
|
||||
name: {
|
||||
type: String
|
||||
}
|
||||
|
||||
},
|
||||
{
|
||||
timestamps: {}
|
||||
});
|
||||
|
||||
module.exports = modb.model('UplFolder', uplFolderSchema);
|
24
models/db/user.js
Normal file
24
models/db/user.js
Normal file
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
|
||||
const modb = require('mongoose'),
|
||||
Promise = require('bluebird'),
|
||||
_ = require('lodash');
|
||||
|
||||
/**
|
||||
* Region schema
|
||||
*
|
||||
* @type {<Mongoose.Schema>}
|
||||
*/
|
||||
var userSchema = modb.Schema({
|
||||
|
||||
email: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
|
||||
},
|
||||
{
|
||||
timestamps: {}
|
||||
});
|
||||
|
||||
module.exports = modb.model('User', userSchema);
|
Reference in New Issue
Block a user