import { Injectable } from '@nestjs/common' ; import { InjectModel } from 'nestjs-typegoose' ; import { Cat } from './cat.model' ; import { ReturnModelType } from '@typegoose/typegoose' ; @ Injectable ( ) export class CatsService { constructor ( @ InjectModel ( Cat ) private readonly catModel ) { } async create ( createCatDto ) { return await this . catModel . create ( createCatDto ) ; } async findAll ( ) { return await this . catModel . find ( ) . exec ( ) ; } }