package com.yinlihupo.enlish.service.controller;

import com.yinlihupo.enlish.service.domain.dataobject.UserDO;
import com.yinlihupo.enlish.service.model.vo.user.FindUserInfoRspVO;
import com.yinlihupo.enlish.service.service.UserService;
import com.yinlihupo.framework.common.response.Response;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user/")
public class UserController {

    @Resource
    private UserService userService;

    @PostMapping("info")
    public Response<FindUserInfoRspVO> info() {

        UserDO user = userService.findUser();
        FindUserInfoRspVO findUserInfoRspVO = FindUserInfoRspVO.builder()
                .id(user.getId())
                .name(user.getName())
                .build();
        return Response.success(findUserInfoRspVO);

    }
}
