hydra/src/main/events/helpers/get-downloads-path.ts
2024-04-21 06:26:29 +01:00

15 lines
406 B
TypeScript

import { userPreferencesRepository } from "@main/repository";
import { defaultDownloadsPath } from "@main/constants";
export const getDownloadsPath = async () => {
const userPreferences = await userPreferencesRepository.findOne({
where: {
id: 1,
},
});
if (userPreferences && userPreferences.downloadsPath)
return userPreferences.downloadsPath;
return defaultDownloadsPath;
};