max: {
major: 1,
minor: 0,
- patch: 3,
+ patch: 4,
},
};
}
+ 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] = Number(contentUpdates));
+
+ return history;
+ }
+
+
async topicSet(dbCtx, data) {
const _scope = _fileScope('topicSet');
this.logger.debug(_scope, 'called', data);
const _scope = _fileScope('topicSetContent');
const topicSetContentData = {
contentType: null,
+ httpETag: null,
+ httpLastModified: null,
...data,
};
const logData = {
if (result.rowCount != 1) {
throw new DBErrors.UnexpectedResult('did not set topic content');
}
- result = await dbCtx.result(this.statement.topicSetContentHistory, { topicId: data.topicId, contentHash: data.contentHash, contentSize: data.content.length });
+ result = await dbCtx.result(this.statement.topicSetContentHistory, {
+ topicId: data.topicId,
+ contentHash: data.contentHash,
+ contentSize: data.content.length,
+ });
if (result.rowCount != 1) {
throw new DBErrors.UnexpectedResult('did not set topic content history');
}