package ink.wgink.gateway.handler.log;

import ink.wgink.gateway.dao.log.IRequestLogDao;
import ink.wgink.gateway.handler.BaseHandler;
import ink.wgink.gateway.pojo.log.RequestLog;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Mono;

import java.net.URI;

/**
 * When you feel like quitting. Think about why you started
 * 当你想要放弃的时候，想想当初你为何开始
 *
 * @ClassName: RequestLogHandler
 * @Description: 请求日志
 * @Author: wanggeng
 * @Date: 2021/5/15 5:27 下午
 * @Version: 1.0
 */
@Service
public class RequestLogHandler extends BaseHandler {

    private IRequestLogDao requestLogDao;

    public RequestLogHandler(IRequestLogDao requestLogDao) {
        this.requestLogDao = requestLogDao;
    }

    public Mono<Void> save(RequestLog requestLog) {
        setSave(requestLog);
        requestLogDao.save(requestLog).subscribe();
        return Mono.empty();
    }
}
