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.
70 lines
1.2 KiB
70 lines
1.2 KiB
import PouchdbHandler from './../db/pouchdbHandler.js'
|
|
|
|
/**
|
|
* getting files
|
|
*
|
|
* @author Björn Hase
|
|
* @license hhttps://www.gnu.org/licenses/gpl-3.0.en.html GPL-3
|
|
* @link https://gitea.node001.net/HerrHase/tellme-bot.git
|
|
*
|
|
*/
|
|
class HubStore extends PouchdbHandler {
|
|
|
|
/**
|
|
*
|
|
* @param {object} data
|
|
* @return {object}
|
|
*
|
|
*/
|
|
create(data)
|
|
{
|
|
data['type'] = 'hub'
|
|
|
|
return this.db.post(data)
|
|
.then((response) => {
|
|
return response
|
|
})
|
|
}
|
|
|
|
/**
|
|
*
|
|
*
|
|
*/
|
|
findOneById(id)
|
|
{
|
|
const query = {
|
|
'selector': {
|
|
'type': 'hub',
|
|
'_id' : id
|
|
}
|
|
}
|
|
|
|
return this.db.find(query).then((documents) => {
|
|
if (documents.docs.length === 0) {
|
|
return null
|
|
} else {
|
|
return documents.docs[0]
|
|
}
|
|
})
|
|
}
|
|
|
|
/**
|
|
*
|
|
*
|
|
*/
|
|
find()
|
|
{
|
|
const query = {
|
|
'selector': {
|
|
'type': 'hub'
|
|
}
|
|
}
|
|
|
|
return this.db.find(query).then((documents) => {
|
|
return documents.docs
|
|
})
|
|
}
|
|
|
|
}
|
|
|
|
export default HubStore |