import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { Repository } from 'typeorm'; import { PGroup } from 'kkk-lib/auth/entity/p-group'; @Injectable() export class PGroupService { constructor( @InjectRepository(PGroup) private readonly pGroupRepository: Repository, ) {} findAll(): Promise { return this.pGroupRepository.find(); } async findOne(name: string): Promise { const p:any = {name:name}; const user = await this.pGroupRepository.findOne(p); return user; } async findOneById(id: number): Promise { const p:any = {id:id}; const user = await this.pGroupRepository.findOne(p); return user; } }