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

import com.xunhong.erp.turbo.api.biz.dto.cmd.AuditUpdateCmd;
import com.xunhong.erp.turbo.api.biz.dto.vo.AuditVO;
import com.xunhong.erp.turbo.biz.app.assembler.AuditAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.Audit;
import com.xunhong.erp.turbo.biz.domain.gateway.AuditGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author shenyifei
 */
@Slf4j
@Component
@RequiredArgsConstructor
public class AuditUpdateCmdExe {

    private final AuditAssembler auditAssembler;
    private final AuditGateway auditGateway;

    public AuditVO execute(AuditUpdateCmd auditUpdateCmd) {
        Audit audit = auditGateway.update(auditUpdateCmd);
        return auditAssembler.toAuditVO(audit);
    }
}
