package com.yaoai.admin.audit;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.yaoai.admin.audit.dto.AuditLogQuery;
import com.yaoai.admin.common.PageResult;
import com.yaoai.common.result.Result;
import com.yaoai.domain.entity.AdminAuditLog;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/admin-api/audit-logs")
@RequiredArgsConstructor
@SaCheckLogin(type = "admin")
public class AdminAuditLogController {

    private final AdminAuditQueryService adminAuditQueryService;

    @GetMapping
    public Result<PageResult<AdminAuditLog>> list(@ModelAttribute AuditLogQuery query) {
        return Result.ok(adminAuditQueryService.list(query));
    }
}
