fix: harden auth flows and align api contracts
This commit is contained in:
@@ -34,7 +34,7 @@ func NewLogHandler(loginLogService *service.LoginLogService, operationLogService
|
||||
// @Param page_size query int false "每页数量"
|
||||
// @Success 200 {object} Response{data=LoginLogListResponse} "登录日志列表"
|
||||
// @Failure 401 {object} Response "未认证"
|
||||
// @Router /api/v1/users/me/login-logs [get]
|
||||
// @Router /api/v1/logs/login/me [get]
|
||||
func (h *LogHandler) GetMyLoginLogs(c *gin.Context) {
|
||||
userID, ok := getUserIDFromContext(c)
|
||||
if !ok {
|
||||
@@ -76,7 +76,7 @@ func (h *LogHandler) GetMyLoginLogs(c *gin.Context) {
|
||||
// @Param page_size query int false "每页数量"
|
||||
// @Success 200 {object} Response{data=OperationLogListResponse} "操作日志列表"
|
||||
// @Failure 401 {object} Response "未认证"
|
||||
// @Router /api/v1/users/me/operation-logs [get]
|
||||
// @Router /api/v1/logs/operation/me [get]
|
||||
func (h *LogHandler) GetMyOperationLogs(c *gin.Context) {
|
||||
userID, ok := getUserIDFromContext(c)
|
||||
if !ok {
|
||||
@@ -120,7 +120,7 @@ func (h *LogHandler) GetMyOperationLogs(c *gin.Context) {
|
||||
// @Param page_size query int false "每页数量"
|
||||
// @Success 200 {object} Response{data=LoginLogListResponse} "登录日志列表"
|
||||
// @Failure 403 {object} Response "无权限"
|
||||
// @Router /api/v1/admin/logs/login [get]
|
||||
// @Router /api/v1/logs/login [get]
|
||||
func (h *LogHandler) GetLoginLogs(c *gin.Context) {
|
||||
var req service.ListLoginLogRequest
|
||||
if err := c.ShouldBindQuery(&req); err != nil {
|
||||
@@ -175,7 +175,7 @@ func (h *LogHandler) GetLoginLogs(c *gin.Context) {
|
||||
// @Success 200 {object} Response{data=OperationLogListResponse} "操作日志列表"
|
||||
// @Failure 403 {object} Response "无权限"
|
||||
// @Failure 500 {object} Response "服务器错误"
|
||||
// @Router /api/v1/admin/logs/operation [get]
|
||||
// @Router /api/v1/logs/operation [get]
|
||||
func (h *LogHandler) GetOperationLogs(c *gin.Context) {
|
||||
var req service.ListOperationLogRequest
|
||||
if err := c.ShouldBindQuery(&req); err != nil {
|
||||
@@ -229,7 +229,7 @@ func (h *LogHandler) GetOperationLogs(c *gin.Context) {
|
||||
// @Success 200 {file} file "CSV文件"
|
||||
// @Failure 403 {object} Response "无权限"
|
||||
// @Failure 500 {object} Response "服务器错误"
|
||||
// @Router /api/v1/admin/logs/login/export [get]
|
||||
// @Router /api/v1/logs/login/export [get]
|
||||
func (h *LogHandler) ExportLoginLogs(c *gin.Context) {
|
||||
var req service.ExportLoginLogRequest
|
||||
if err := c.ShouldBindQuery(&req); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user