package dev.lions.user.manager.server.impl.repository;

import dev.lions.user.manager.server.impl.entity.SyncHistoryEntity;
import io.quarkus.hibernate.orm.panache.PanacheRepository;
import jakarta.enterprise.context.ApplicationScoped;

import java.util.List;

@ApplicationScoped
public class SyncHistoryRepository implements PanacheRepository<SyncHistoryEntity> {

    public List<SyncHistoryEntity> findLatestByRealm(String realmName, int limit) {
        return find("realmName = ?1 ORDER BY syncDate DESC", realmName)
                .page(0, limit)
                .list();
    }
}
