import { Injectable } from '@nestjs/common' ; import { CreateRoleDto } from "./dto/create-role.dto" ; import { InjectModel } from "@nestjs/sequelize" ; import { Role } from "./roles.model" ; @ Injectable ( ) export class RolesService { constructor ( @ InjectModel ( Role ) private roleRepository ) { } async createRole ( dto ) { const role = await this . roleRepository . create ( dto ) ; return role ; } async getRoleByValue ( value ) { const role = await this . roleRepository . findOne ( { where : { value } } ) ; return role ; } }