Interface: IDatabaseCommand<TResult>
Defined in: electron/services/commands/DatabaseCommands.ts:34
Base interface for all database commands.
Remarks
Defines the contract for atomic database operations with rollback capabilities, including validation, execution, rollback, and description for logging.
Type Parameters
TResult
TResult
= void
The result type returned by the command's execute method.
Properties
execute()
execute: () =>
Promise
<TResult
>
Defined in: electron/services/commands/DatabaseCommands.ts:45
Executes the command operation.
Returns
Promise
<TResult
>
Promise resolving to the operation result.
Remarks
Performs the main database operation encapsulated by the command.
Throws
When command execution fails.
getDescription()
getDescription: () =>
string
Defined in: electron/services/commands/DatabaseCommands.ts:52
Gets a description of the command for logging and debugging.
Returns
string
Human-readable command description.
rollback()
rollback: () =>
Promise
<void
>
Defined in: electron/services/commands/DatabaseCommands.ts:63
Rolls back the command operation if possible.
Returns
Promise
<void
>
Promise resolving when rollback is complete.
Remarks
Attempts to revert the effects of the command. Not all commands require rollback.
validate()
validate: () =>
Promise
<{errors
:string
[];isValid
:boolean
; }>
Defined in: electron/services/commands/DatabaseCommands.ts:74
Validates the command before execution.
Returns
Promise
<{ errors
: string
[]; isValid
: boolean
; }>
Promise resolving to validation result.
Remarks
Ensures the command is in a valid state before execution. Returns a validation result with errors if any.