|
|
@@ -1,5 +1,4 @@
|
|
|
module.exports = function(crowi, app) {
|
|
|
- 'use strict';
|
|
|
|
|
|
const Tag = crowi.model('Tag');
|
|
|
const PageTagRelation = crowi.model('PageTagRelation');
|
|
|
@@ -19,8 +18,8 @@ module.exports = function(crowi, app) {
|
|
|
*/
|
|
|
api.search = async function(req, res) {
|
|
|
let tags = await Tag.find({}).select('-_id name');
|
|
|
- tags = tags.map(tag => tag.name);
|
|
|
- return res.json(ApiResponse.success({tags}));
|
|
|
+ tags = tags.map((tag) => { return tag.name });
|
|
|
+ return res.json(ApiResponse.success({ tags }));
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
@@ -32,8 +31,8 @@ module.exports = function(crowi, app) {
|
|
|
*/
|
|
|
api.get = async function(req, res) {
|
|
|
let tags = await PageTagRelation.find({relatedPage: req.query.pageId}).populate('relatedTag').select('-_id relatedTag');
|
|
|
- tags = tags.map(tag => tag.relatedTag.name);
|
|
|
- return res.json(ApiResponse.success({tags}));
|
|
|
+ tags = tags.map((tag) => { return tag.relatedTag.name });
|
|
|
+ return res.json(ApiResponse.success({ tags }));
|
|
|
};
|
|
|
|
|
|
return actions;
|