import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { Feature } from '../entities/feature.entity';

@Injectable()
export class FeatureService {
  constructor(
    @InjectRepository(Feature)
    private featureRepository: Repository<Feature>,
  ) {}

  async findRoleFeatureApi(roleId) {
    return this.featureRepository.find({
      where: { roleId },
      select: ['id', 'name', 'type'],
    });
  }
}
