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