X-Git-Url: http://git.squeep.com/?p=websub-hub;a=blobdiff_plain;f=src%2Fdb%2Fsqlite%2Findex.js;h=cc4ea90af056db2c99f747f2705e25829801749a;hp=b8826a4f15ee424113e72fd790b41b8212bf3cf8;hb=737fbd003d5c4dfea81b667ef906f1c106a60612;hpb=17b4ff9c1974842c02071d2cd02144d2e5a99eb5 diff --git a/src/db/sqlite/index.js b/src/db/sqlite/index.js index b8826a4..cc4ea90 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] = contentUpdates); + + return history; + } + + topicSet(dbCtx, data) { const _scope = _fileScope('topicSet'); this.logger.debug(_scope, 'called', data);