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