import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { Repository } from 'typeorm'; import { PUserType } from 'kkk-lib/auth/entity/p-user-type.entity'; @Injectable() export class UserTypeService { constructor( @InjectRepository(PUserType) private readonly repository: Repository, ) {} async create(userType: { name: string; level?: number }): Promise { return this.repository.save(userType); } async findOne(name: string): Promise { const p:any = {name:name} const userType = await this.repository.findOne(p); return userType; } }