adding boolean setting config
This commit is contained in:
@@ -2,6 +2,7 @@ package zw.qantra.tm.domain.services;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import zw.qantra.tm.domain.models.Setting;
|
||||
import zw.qantra.tm.domain.repositories.SettingRepository;
|
||||
|
||||
@Service
|
||||
@@ -12,4 +13,17 @@ public class SettingService {
|
||||
public SettingRepository getSettingRepository() {
|
||||
return settingRepository;
|
||||
}
|
||||
|
||||
public Boolean getBooleanSetting(String key) {
|
||||
try {
|
||||
Setting setting = settingRepository.findBySettingName(key);
|
||||
if (setting != null) {
|
||||
return Boolean.parseBoolean(setting.getSettingValue());
|
||||
}
|
||||
return false;
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user