unleash-server
Version:
Unleash is an enterprise ready feature flag service. It provides different strategies for handling feature flags.
34 lines • 1.04 kB
JavaScript
export default class UserSplashService {
constructor({ userSplashStore }, { getLogger }) {
this.userSplashStore = userSplashStore;
this.logger = getLogger('services/user-splash-service.js');
}
async getAllUserSplashes(user) {
if (user.isAPI) {
return {};
}
try {
return (await this.userSplashStore.getAllUserSplashes(user.id)).reduce((splashObject, splash) => ({
...splashObject,
[splash.splashId]: splash.seen,
}), {});
}
catch (err) {
this.logger.error(err);
return {};
}
}
async getSplash(user_id, splash_id) {
return this.userSplashStore.getSplash(user_id, splash_id);
}
async updateSplash(splash) {
try {
return await this.userSplashStore.updateSplash(splash);
}
catch (err) {
this.logger.warn(err);
return splash;
}
}
}
//# sourceMappingURL=user-splash-service.js.map