package cn.novalon.gym.manage.db.dao;

import cn.novalon.gym.manage.db.entity.OperationLogEntity;
import org.springframework.data.r2dbc.repository.R2dbcRepository;
import org.springframework.stereotype.Repository;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import java.time.LocalDateTime;

@Repository
public interface OperationLogDao extends R2dbcRepository<OperationLogEntity, Long> {

    Flux<OperationLogEntity> findByUsernameAndDeletedAtIsNull(String username);

    Flux<OperationLogEntity> findByDeletedAtIsNull();

    Mono<Long> countByDeletedAtIsNull();

    Mono<Long> countByCreatedAtAfterAndDeletedAtIsNull(LocalDateTime dateTime);
}