package ru.soune.nocopy.entity.file;

import jakarta.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import ru.soune.nocopy.repository.FileEntityRepository;

@Component
public class SupportIdInitializer {

    @Autowired
    private FileEntityRepository fileRepository;

    @PostConstruct
    public void init() {
        Integer maxId = fileRepository.findMaxSupportId();
        if (maxId != null) {
            FileEntity.initializeCounter(maxId);
        }
    }
}
