package com.red.circle.other.app.inner.service.dynamic.impl;


import com.red.circle.other.app.inner.convertor.dynamic.DynamicInnerConvertor;
import com.red.circle.other.app.inner.service.dynamic.DynamicPictureClientService;
import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicPicture;
import com.red.circle.other.infra.database.rds.service.dynamic.DynamicPictureService;
import com.red.circle.other.inner.model.cmd.dynamic.DynamicPictureCmd;
import java.util.Objects;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 动态内容 服务实现类.
 * </p>
 *
 * @author pengshigang
 * @since 2022-06-30
 */
@Service
@RequiredArgsConstructor
public class DynamicPictureClientServiceImpl implements DynamicPictureClientService {

  private final DynamicInnerConvertor dynamicInnerConvertor;
  private final DynamicPictureService dynamicPictureService;

  @Override
  public void save(DynamicPictureCmd cmd) {
    DynamicPicture dynamicPicture= dynamicInnerConvertor.toDynamicPicture(cmd);
    if(Objects.nonNull(dynamicPicture)){
      dynamicPictureService.save(dynamicPicture);
    }
  }
}

