X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=src%2Fdb%2Fsqlite%2Findex.js;h=31471bafb850c9d761ffc19931968658eb093258;hb=e3bce15e1777f5d7b03b7ba15444ca4335ec9bde;hp=b8826a4f15ee424113e72fd790b41b8212bf3cf8;hpb=33897b863a84ff7d248888f83dc100a96cd9bc49;p=websub-hub diff --git a/src/db/sqlite/index.js b/src/db/sqlite/index.js index b8826a4..31471ba 100644 --- a/src/db/sqlite/index.js +++ b/src/db/sqlite/index.js @@ -822,6 +822,18 @@ class DatabaseSQLite extends Database { } + topicPublishHistory(dbCtx, topicId, days) { + const _scope = _fileScope('topicPublishHistory'); + this.logger.debug(_scope, 'called', { topicId, days }) + + const events = this.statement.topicPublishHistory.all({ topicId, daysAgo: days }); + const history = Array.from({ length: days }, () => 0); + events.forEach(({ daysAgo, contentUpdates }) => history[daysAgo] = Number(contentUpdates)); + + return history; + } + + topicSet(dbCtx, data) { const _scope = _fileScope('topicSet'); this.logger.debug(_scope, 'called', data);