You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
1.6 KiB

import DirectusAbstractStore from './directusAbstract.js'
/**
* Comments
*
* @author Björn Hase <me@herr-hase.wtf>
* @license http://opensource.org/licenses/MIT The MIT License
* @link https://gitea.node001.net/HerrHase/super-fastify-directus.git
*
*/
class CommentStore extends DirectusAbstractStore {
/**
*
*
* @param {String} endpoint
*
*/
constructor() {
super('comments')
}
/**
* getting page by permalink
*
* @param {String} permalink
* @return {Object}
*
*/
find(page, uuid, limit = 20) {
return this.items.readByQuery({
fields: [
'name',
'content',
'approved',
'belongs_to.comments_id'
],
filter: {
approved : true,
belongs_to : {
comments_id: uuid
}
},
limit : limit,
offset : ((page - 1) * limit)
})
}
/**
* getting page by permalink
*
* @param {String} permalink
* @return {Object}
*
*/
page(page, uuid, limit = 20) {
return this.items.readByQuery({
fields: [
'name',
'content',
'approved',
'belongs_to.comments_id'
],
filter: {
approved : true,
belongs_to : {
comments_id: uuid
}
},
limit : limit,
offset : ((page - 1) * limit)
})
}
}
export default CommentStore