Yield generated for ed736971-4f8e-4463-a99e-5549cb4b7e68
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

14 lines
480 B

import { EntityRepository, Repository } from 'typeorm';
import { Role } from './roles.entity';
import { Optional } from 'typescript-optional';
@EntityRepository(Role)
export class RolesRepository extends Repository<Role> {
async findRoleByName(name: string): Promise<Optional<Role>> {
return Optional.ofNullable(await this.findOne({ name }));
}
async findOneById(id: number): Promise<Optional<Role>> {
return Optional.ofNullable(await this.findOne(id, {}));
}
}