251202_01_ENH: User 관련 기능 구현

This commit is contained in:
2025-12-02 13:46:44 +09:00
parent bff9747d52
commit d13595f315
52 changed files with 1279 additions and 159 deletions

View File

@@ -0,0 +1,34 @@
package com.kri.contact.server.controller;
import com.kri.common.webmvc.RequestUserContext;
import com.kri.contact.server.dto.LoginRequestDto;
import com.kri.contact.server.dto.LoginResponseDto;
import com.kri.contact.server.service.AuthService;
import com.kri.contact.server.service.SystemEventLogService;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/api/v1/auth")
@RequiredArgsConstructor
@Tag(name = "Auth", description = "인증 API")
public class AuthController {
private final AuthService authService;
private final SystemEventLogService systemEventLogService;
@PostMapping("/login")
public LoginResponseDto tryLogin(@RequestBody LoginRequestDto request, RequestUserContext ctx){
LoginResponseDto response = authService.tryLogin(request);
systemEventLogService.writeLoginLog(response.getUser().getUserId(), ctx.getClientIp());
return response;
}
@PostMapping("/logout/{userId}")
public boolean logout(@PathVariable String userId, RequestUserContext ctx){
systemEventLogService.writeLogoutLog(userId, ctx.getClientIp());
return true;
}
}