mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-17 19:37:02 +00:00
19 lines
426 B
TypeScript
19 lines
426 B
TypeScript
import AppError from "../errors/AppError";
|
|
import Setting from "../models/Setting";
|
|
|
|
const CheckSettings = async (key: string): Promise<string> => {
|
|
const settingsRepository = getRepository(Setting);
|
|
|
|
const setting = await settingsRepository.findOne({
|
|
where: { key }
|
|
});
|
|
|
|
if (!setting) {
|
|
throw new AppError("No setting found with this id.", 404);
|
|
}
|
|
|
|
return setting.value;
|
|
};
|
|
|
|
export default CheckSettings;
|