mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-19 20:29:17 +00:00
started migration of user domain to ts
This commit is contained in:
18
backend/src/helpers/CheckSettingsHelper.ts
Normal file
18
backend/src/helpers/CheckSettingsHelper.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user