mirror of
https://github.com/orangecoding/fredy.git
synced 2026-06-16 12:31:07 +00:00
Fredy 2.0.0 introduces the concept of search jobs. You can now configure multiple of these jobs running in the same instance of Fredy. Also a new API has been created 🎉
53 lines
999 B
JavaScript
53 lines
999 B
JavaScript
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;
|
|
};
|
|
/*
|
|
class Store {
|
|
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] || [];
|
|
}
|
|
}
|
|
|
|
module.exports = Store;
|
|
*/
|