import { Model } from 'mongoose' ; import { Injectable } from '@nestjs/common' ; import { InjectModel } from '@nestjs/mongoose' ; import { Cat } from './interfaces/cat.interface' ; import { CatInput } from './inputs/cat.input' ; @ Injectable ( ) export class CatsService { constructor ( @ InjectModel ( 'Cat' ) private readonly catModel ) { } async create ( createCatDto ) { const createdCat = new this . catModel ( createCatDto ) ; return await createdCat . save ( ) ; } async findAll ( ) { return await this . catModel . find ( ) . exec ( ) ; } }