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

import com.xunhong.erp.turbo.api.user.dto.cmd.UserUpdateCmd;
import com.xunhong.erp.turbo.api.user.dto.vo.UserVO;
import com.xunhong.erp.turbo.user.app.assembler.UserAssembler;
import com.xunhong.erp.turbo.user.domain.entity.User;
import com.xunhong.erp.turbo.user.domain.gateway.UserGateway;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

@Component
@RequiredArgsConstructor
public class UserUpdateCmdExe {
	private final UserGateway userGateway;
	private final UserAssembler userAssembler;

	public UserVO execute(UserUpdateCmd userUpdateCmd) {
		User user = userGateway.updateUser(userUpdateCmd);
		return userAssembler.toUserVO(user);
	}
}
