package com.xunhong.erp.turbo.user.app.executor.cmd;

import com.xunhong.erp.turbo.api.user.dto.cmd.EmployeeUpdateAvatarCmd;
import com.xunhong.erp.turbo.api.user.dto.vo.EmployeeVO;
import com.xunhong.erp.turbo.user.app.assembler.EmployeeAssembler;
import com.xunhong.erp.turbo.user.domain.entity.Employee;
import com.xunhong.erp.turbo.user.domain.gateway.EmployeeGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author shenyifei
 */
@Slf4j
@Component
@RequiredArgsConstructor
public class EmployeeUpdateAvatarCmdExe {
	private final EmployeeGateway employeeGateway;

	private final EmployeeAssembler employeeAssembler;

	public EmployeeVO execute(EmployeeUpdateAvatarCmd employeeUpdateAvatarCmd) {
		Employee employee = employeeGateway.updateAvatar(employeeUpdateAvatarCmd);

		return employeeAssembler.toEmployeeVO(employee);
	}
}
