2020-02-26 09:05:20 +01:00
|
|
|
const db = {};
|
|
|
|
|
|
|
|
|
|
exports.init = () => {
|
|
|
|
|
return new Promise(resolve => {
|
|
|
|
|
resolve();
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.setKnownListings = (jobKey, providerId, listings) => {
|
|
|
|
|
if (!Array.isArray(listings)) throw Error('Not a valid array');
|
|
|
|
|
|
|
|
|
|
db[providerId] = listings;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.getKnownListings = (jobKey, providerId) => {
|
|
|
|
|
return db[providerId] || [];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.setNumberOfTotalFoundProviderListings = () => {
|
|
|
|
|
/*noop*/
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.getForTesting = () => {
|
|
|
|
|
return db;
|
|
|
|
|
};
|
|
|
|
|
/*
|
2018-01-20 20:23:27 +01:00
|
|
|
class Store {
|
2020-02-26 09:05:20 +01:00
|
|
|
constructor(name) {
|
|
|
|
|
this._name = name;
|
|
|
|
|
this._db = {};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get warmup() {
|
|
|
|
|
this._db = {};
|
|
|
|
|
return new Promise(resolve => resolve());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set knownListings(value) {
|
|
|
|
|
if (!Array.isArray(value)) throw Error('Not a valid array');
|
|
|
|
|
return new Promise(resolve => {
|
|
|
|
|
this._db[this._name] = value;
|
|
|
|
|
resolve(value);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get knownListings() {
|
|
|
|
|
return this._db[this._name] || [];
|
|
|
|
|
}
|
2018-01-20 20:23:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.exports = Store;
|
2020-02-26 09:05:20 +01:00
|
|
|
*/
|