import { Injectable } from '@nestjs/common' ; import { MongooseService , ResultList } from 'nestx-common' ; import { PhotoModel } from './../interfaces' ; import { Model } from 'mongoose' ; import { InjectModel } from '@nestjs/mongoose' ; @ Injectable ( ) export class PhotoService extends MongooseService < PhotoModel > { defaultQueryFields = [ 'name' , 'caption' , 'description' , 'ext' , 'url' , 'uri' ] ; constructor ( @ InjectModel ( 'Photo' ) protected readonly model ) { super ( model ) ; } async querySearch ( keyword , page , size , sort ) { return super . query ( page , size , { } , { keyword , field : 'name' } , this . defaultQueryFields , sort ) ; } }