package com.tuoheng.controller;

import com.tuoheng.model.param.CreateUserDto;
import com.tuoheng.model.param.GetUserInfoDto;
import com.tuoheng.service.UserSevice;
import com.tuoheng.until.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * @author chenjiandong
 * @description: TODO
 * @date 2022/10/8 11:20
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserSevice userSevice;

    @PostMapping("/create")
    public JsonResult createUser(@RequestBody CreateUserDto createUserDto){
        return userSevice.createUser(createUserDto);
    }

    /**
     * 小程序端获取用户信息端点
     * @param getUserInfoDto
     * @return
     */
    @PostMapping("/getInfo")
    public JsonResult getUserInfo(@RequestBody GetUserInfoDto getUserInfoDto){
        return userSevice.getUserInfo(getUserInfoDto);
    }

}
