dd-timer/src/application/commands/UpdateSettings.ts
POL Mickaël 3e485fd09b chore: normalise fins de ligne CRLF → LF dans tout le repo
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>
2026-04-06 08:55:10 +02:00

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);
};
}