package io.gmss.fiscad.configuration;


import io.gmss.fiscad.repositories.user.UserRepository;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.domain.AuditorAware;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;

@Configuration
@EnableJpaAuditing(auditorAwareRef = "auditorProvider")
public class AuditConfig {

    private final UserRepository userRepository;

    public AuditConfig(UserRepository userRepository) {
        this.userRepository = userRepository;
    }


    @Bean
    public AuditorAware<Long> auditorProvider() {
        return new AuditorAwareImpl(userRepository);
    }

}
