package org.springblade.modules.app.web;


import com.wn.common.datamodel.ResultDTO;
import org.springblade.modules.app.common.dto.AppUserIdDTO;
import org.springblade.modules.app.common.dto.UserDTO;
import org.springblade.modules.app.manager.AppUserIdManager;
import org.springblade.modules.app.utils.UserUtils;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import com.wn.common.controller.BaseController;

/**
 * <p>
 * app用户标识表 前端控制器
 * </p>
 *
 * @author huyinuo
 * @since 2022-01-17
 */
@RestController
@RequestMapping("app/appUserId")
public class AppUserIdController extends BaseController {

    @Autowired
    private AppUserIdManager appUserIdManager;

    @Autowired
    private UserUtils userUtils;

    @PostMapping
    //@ApiOperation(value = "新增app用户标识")
    public ResponseEntity<ResultDTO<Boolean>> addAppUserId(@RequestBody AppUserIdDTO appUserIdDTO) {
        UserDTO userDTO = userUtils.getUser(appUserIdDTO.getToken());
        String clientId = appUserIdDTO.getClientId();
        return success(appUserIdManager.addAppUserId(clientId, userDTO));
    }

}

