package com.kamco.cd.kamcoback.postgres.repository.menu;

import static com.kamco.cd.kamcoback.postgres.entity.QMenuEntity.menuEntity;

import com.kamco.cd.kamcoback.postgres.entity.MenuEntity;
import com.querydsl.core.types.dsl.Expressions;
import com.querydsl.core.types.dsl.StringExpression;
import com.querydsl.jpa.impl.JPAQueryFactory;
import java.util.List;
import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport;

public class MenuRepositoryImpl extends QuerydslRepositorySupport implements MenuRepositoryCustom {

  private final JPAQueryFactory queryFactory;
  private final StringExpression NULL_STRING = Expressions.stringTemplate("cast(null as text)");

  public MenuRepositoryImpl(JPAQueryFactory queryFactory) {
    super(MenuEntity.class);
    this.queryFactory = queryFactory;
  }

  @Override
  public List<MenuEntity> getFindAll() {
    return queryFactory.selectFrom(menuEntity).where(menuEntity.deleted.isFalse()).fetch();
  }
}
