X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=src%2Fdb%2Fbase.js;h=205b8149778928a0ab915d83e9aaf64c158c35b8;hb=HEAD;hp=de0cd44a1b9c5a77eb0e8fcb22771ffbf7c488c1;hpb=085b55f507dedc16016bb491d520c556acd60643;p=websub-hub diff --git a/src/db/base.js b/src/db/base.js index de0cd44..205b814 100644 --- a/src/db/base.js +++ b/src/db/base.js @@ -137,7 +137,7 @@ class Database { * @param {Object} data */ _leaseDurationsValidate(data) { - const leaseProperties = Object.keys(this.topicLeaseDefaults) + const leaseProperties = Object.keys(this.topicLeaseDefaults); this._ensureTypes(data, leaseProperties, ['number', 'undefined', 'null']); // Populate defaults on a copy of values so we can check proper numerical ordering @@ -173,6 +173,8 @@ class Database { this._ensureTypes(data, ['content'], ['string', 'buffer']); this._ensureTypes(data, ['contentHash'], ['string']); this._ensureTypes(data, ['contentType'], ['string', 'null', 'undefined']); + this._ensureTypes(data, ['eTag'], ['string', 'null', 'undefined']); + this._ensureTypes(data, ['lastModified'], ['string', 'null', 'undefined']); } @@ -548,8 +550,9 @@ class Database { * Get topic data, without content. * @param {*} dbCtx * @param {String} topicUrl + * @param {Boolean} applyDefaults */ - async topicGetByUrl(dbCtx, topicUrl) { + async topicGetByUrl(dbCtx, topicUrl, applyDefaults = true) { this._notImplemented('topicGetByUrl', arguments); } @@ -585,6 +588,18 @@ class Database { } + /** + * Return an array of the counts of the last #days of topic updates. + * @param {*} dbCtx + * @param {*} topicId + * @param {Number} days + * @returns {Number[]} + */ + async topicPublishHistory(dbCtx, topicId, days) { + this._notImplemented('topicPublishHistory', arguments); + } + + /** * Create or update the basic parameters of a topic. * @param {*} dbCtx @@ -598,10 +613,12 @@ class Database { /** * Updates a topic's content data and content update timestamp. * @param {Object} data - * @param {Integer} data.topicId + * @param {*} data.topicId * @param {String} data.content * @param {String} data.contentHash * @param {String=} data.contentType + * @param {String=} data.eTag + * @param {String=} data.lastModified */ async topicSetContent(dbCtx, data) { this._notImplemented('topicSetContent', arguments);