package com.red.circle.console.app.command.admin;

import com.red.circle.console.app.convertor.RoleAppConvertor;
import com.red.circle.console.app.dto.cmd.admin.RoleCmd;
import com.red.circle.console.infra.database.rds.service.admin.RoleService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * 添加角色.
 *
 * @author pengliang on 2023/5/12
 */
@Component
@RequiredArgsConstructor
public class RoleAddCmdExe {

  private final RoleService roleService;
  private final RoleAppConvertor roleAppConvertor;

  public void execute(RoleCmd cmd) {
    roleService.save(roleAppConvertor.toRole(cmd));
  }

}
