import { Model } from 'mongoose' ; import { Injectable } from '@nestjs/common' ; import { InjectModel } from '@nestjs/mongoose' ; import { DictModel } from './../interfaces' ; import { MongooseService , ResultList } from 'nestx-common' ; @ Injectable ( ) export class DictsService extends MongooseService < DictModel > { defaultQueryFields = [ 'name' , 'category' , 'translate' , 'expand' ] ; constructor ( @ InjectModel ( 'Dict' ) protected readonly model ) { super ( model ) ; } async querySearch ( keyword , category , page , size , sort ) { return super . query ( page , size , { category , } , { keyword , field : 'name' } , this . defaultQueryFields , sort ) ; } }