|
|
@ -1,6 +1,6 @@
|
|
|
|
import Book from '../../data/Book';
|
|
|
|
import Book from '../../data/Book';
|
|
|
|
import Auth from '../../data/Auth';
|
|
|
|
import Auth from '../../data/Auth';
|
|
|
|
import Navigation from '../../data/Navigation';
|
|
|
|
import Settings from '../../data/Settings';
|
|
|
|
import * as DataEvent from '../../../src/com/events/DataEvent';
|
|
|
|
import * as DataEvent from '../../../src/com/events/DataEvent';
|
|
|
|
const express = require('express');
|
|
|
|
const express = require('express');
|
|
|
|
const router = express.Router();
|
|
|
|
const router = express.Router();
|
|
|
@ -8,8 +8,8 @@ const multer = require('multer');
|
|
|
|
const fs = require('fs-extra');
|
|
|
|
const fs = require('fs-extra');
|
|
|
|
const moment = require('moment');
|
|
|
|
const moment = require('moment');
|
|
|
|
const book = new Book();
|
|
|
|
const book = new Book();
|
|
|
|
const nav = new Navigation();
|
|
|
|
|
|
|
|
const auth = new Auth();
|
|
|
|
const auth = new Auth();
|
|
|
|
|
|
|
|
const settings = new Settings();
|
|
|
|
const _ = require('lodash');
|
|
|
|
const _ = require('lodash');
|
|
|
|
const uploadPath =
|
|
|
|
const uploadPath =
|
|
|
|
'./public/assets/images/blog/' + moment().format('YYYY') + '/' + moment().format('MM');
|
|
|
|
'./public/assets/images/blog/' + moment().format('YYYY') + '/' + moment().format('MM');
|
|
|
@ -68,8 +68,8 @@ router.post('/write/:task?', feature_upload, (req, res) => {
|
|
|
|
body.deleted = false;
|
|
|
|
body.deleted = false;
|
|
|
|
book.editPage(body, body.page_uuid, task, req.session.user)
|
|
|
|
book.editPage(body, body.page_uuid, task, req.session.user)
|
|
|
|
.then(result => {
|
|
|
|
.then(result => {
|
|
|
|
if (result.type === DataEvent.PAGE_CREATE) {
|
|
|
|
if (result.type === DataEvent.PAGE_ADDED) {
|
|
|
|
nav.updatePageStats();
|
|
|
|
settings.updatePageIndex();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
res.json(result);
|
|
|
|
res.json(result);
|
|
|
|
})
|
|
|
|
})
|
|
|
|