feat: migrating user preferences

This commit is contained in:
Chubby Granny Chaser 2025-01-21 03:48:46 +00:00
parent d760d0139d
commit f1e0ba4dd6
No known key found for this signature in database
53 changed files with 737 additions and 790 deletions

View file

@ -1,12 +1,15 @@
import { userPreferencesRepository } from "@main/repository";
import { defaultDownloadsPath } from "@main/constants";
import { levelKeys } from "@main/level";
import type { UserPreferences } from "@types";
import { db } from "@main/level";
export const getDownloadsPath = async () => {
const userPreferences = await userPreferencesRepository.findOne({
where: {
id: 1,
},
});
const userPreferences = await db.get<string, UserPreferences>(
levelKeys.userPreferences,
{
valueEncoding: "json",
}
);
if (userPreferences && userPreferences.downloadsPath)
return userPreferences.downloadsPath;