X-Git-Url: http://git.squeep.com/?p=websub-hub;a=blobdiff_plain;f=src%2Fdb%2Fpostgres%2Findex.js;h=3e97336992999adaee4a077c1f7ef9ddc7719a87;hp=d950d4a8488924ea2999a9c03b03d93f38ab4591;hb=737fbd003d5c4dfea81b667ef906f1c106a60612;hpb=17b4ff9c1974842c02071d2cd02144d2e5a99eb5 diff --git a/src/db/postgres/index.js b/src/db/postgres/index.js index d950d4a..3e97336 100644 --- a/src/db/postgres/index.js +++ b/src/db/postgres/index.js @@ -856,6 +856,18 @@ class DatabasePostgres extends Database { } + async topicPublishHistory(dbCtx, topicId, days) { + const _scope = _fileScope('topicPublishHistory'); + this.logger.debug(_scope, 'called', { topicId, days }); + + const events = await dbCtx.manyOrNone(this.statement.topicPublishHistory, { topicIds: [topicId], daysAgo: days }); + const history = Array.from({ length: days }, () => 0); + events.forEach(({ daysAgo, contentUpdates }) => history[daysAgo] = contentUpdates); + + return history; + } + + async topicSet(dbCtx, data) { const _scope = _fileScope('topicSet'); this.logger.debug(_scope, 'called', data);