package com.red.circle.other.app.command.room.query;

import com.red.circle.common.business.dto.cmd.app.AppUserIdCmd;
import com.red.circle.other.app.convertor.live.RoomProfileAppConvertor;
import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService;
import com.red.circle.other.inner.model.dto.live.RoomProfileManagerDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * 获取房间语音资料.
 *
 * @author pengliang on 2021/4/15
 */
@Component
@RequiredArgsConstructor
public class RoomProfileByUserIdQryExe {

  private final RoomProfileAppConvertor roomProfileAppConvertor;
  private final RoomProfileManagerService roomProfileManagerService;

  public RoomProfileManagerDTO execute(AppUserIdCmd cmd) {
    return roomProfileAppConvertor.toRoomProfileManagerDTO(
        roomProfileManagerService.getByUserId(cmd.getUserId())
    );
  }
}
