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

import com.red.circle.framework.core.dto.CommonCommand;
import com.red.circle.other.app.convertor.room.RoomThemeAppConvertor;
import com.red.circle.other.app.dto.clientobject.room.RoomThemeUserUserCustomizeCO;
import com.red.circle.other.infra.database.rds.service.props.RoomThemeUserCustomizeService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * 获取用户自定主题
 *
 * @author pengliang on 2021/1/23w
 */
@Component
@RequiredArgsConstructor
public class UserLatestCustomizeThemeQryExe {

  private final RoomThemeAppConvertor roomThemeAppConvertor;
  private final RoomThemeUserCustomizeService roomThemeUserCustomizeService;

  public RoomThemeUserUserCustomizeCO execute(CommonCommand cmd) {
    return roomThemeAppConvertor.toRoomThemeUserUserCustomizeCO(
        roomThemeUserCustomizeService.getLatestCustomize(cmd.requiredReqUserId()));
  }
}
