Applique .gitattributes sur tous les fichiers existants. Élimine les différences fantômes entre WSL et Windows. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
20 lines
743 B
TypeScript
Executable File
20 lines
743 B
TypeScript
Executable File
import type { AppState, StateRepository } from '@domain/ports/StateRepository';
|
|
|
|
export interface UpdateSettingsCommand {
|
|
type: 'update-settings';
|
|
alarmSound?: string;
|
|
notifsEnabled?: boolean;
|
|
ntfyTopic?: string;
|
|
inventaire?: Record<string, { m: number; f: number }>;
|
|
}
|
|
|
|
export function createUpdateSettingsHandler(state: AppState, repo: StateRepository) {
|
|
return (cmd: UpdateSettingsCommand): void => {
|
|
if (cmd.alarmSound !== undefined) state.alarmSound = cmd.alarmSound;
|
|
if (cmd.notifsEnabled !== undefined) state.notifsEnabled = cmd.notifsEnabled;
|
|
if (cmd.ntfyTopic !== undefined) state.ntfyTopic = cmd.ntfyTopic;
|
|
if (cmd.inventaire !== undefined) state.inventaire = cmd.inventaire;
|
|
repo.save(state);
|
|
};
|
|
}
|