import { Injectable } from "@nestjs/common" ; import { InjectRepository } from "@nestjs/typeorm" ; import { findAndPaginate , ConnectionArgs } from "nestjs-graphql-relay" ; import { FindManyOptions , Repository } from "typeorm" ; import { Recipe } from "./models/recipe" ; @ Injectable ( ) export class RecipesService { constructor ( @ InjectRepository ( Recipe ) private readonly recipes ) { } async findById ( id ) { return this . recipes . findOneOrFail ( id ) ; } async find ( where , order , connArgs ) { return findAndPaginate ( { where , order } , connArgs , this . recipes ) ; } }