14 lines
301 B
JavaScript
14 lines
301 B
JavaScript
export class DeleteUserCommandHandler {
|
|
constructor(userRepository) {
|
|
this.userRepository = userRepository;
|
|
}
|
|
|
|
async handle(command) {
|
|
const result = await this.userRepository.delete(command.id);
|
|
if (!result) {
|
|
throw new Error('User not found');
|
|
}
|
|
return result;
|
|
}
|
|
}
|