mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-29 05:41:03 +00:00
first commit
This commit is contained in:
11
src/main/events/user-preferences/get-user-preferences.ts
Normal file
11
src/main/events/user-preferences/get-user-preferences.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { userPreferencesRepository } from "@main/repository";
|
||||
import { registerEvent } from "../register-event";
|
||||
|
||||
const getUserPreferences = async (_event: Electron.IpcMainInvokeEvent) =>
|
||||
userPreferencesRepository.findOne({
|
||||
where: { id: 1 },
|
||||
});
|
||||
|
||||
registerEvent(getUserPreferences, {
|
||||
name: "getUserPreferences",
|
||||
});
|
||||
21
src/main/events/user-preferences/update-user-preferences.ts
Normal file
21
src/main/events/user-preferences/update-user-preferences.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { userPreferencesRepository } from "@main/repository";
|
||||
import { registerEvent } from "../register-event";
|
||||
|
||||
import type { UserPreferences } from "@types";
|
||||
|
||||
const updateUserPreferences = async (
|
||||
_event: Electron.IpcMainInvokeEvent,
|
||||
preferences: Partial<UserPreferences>
|
||||
) => {
|
||||
await userPreferencesRepository.upsert(
|
||||
{
|
||||
id: 1,
|
||||
...preferences,
|
||||
},
|
||||
["id"]
|
||||
);
|
||||
};
|
||||
|
||||
registerEvent(updateUserPreferences, {
|
||||
name: "updateUserPreferences",
|
||||
});
|
||||
Reference in New Issue
Block a user