package com.ruoyi.auth.controller;

import com.ruoyi.auth.service.Oauth2Service;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.system.api.domain.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/oauth2")
public class Oauth2Controller extends BaseController {
    @Autowired
    private Oauth2Service oauth2Service;

    @PostMapping
    public AjaxResult add(@Validated @RequestBody SysUser user) {
        return toAjax(oauth2Service.insertOauth2User(user));
    }

    @PutMapping
    public AjaxResult edit(@Validated @RequestBody SysUser user) {
        return toAjax(oauth2Service.updateOauth2User(user));
    }
}
