import { Application } from '@feathersjs/express'; import service from 'feathers-mongoose'; import { populate } from 'feathers-hooks-common'; import Model from '../models/transfer/transfer.model'; import formatDate from '../hooks/formatDate'; const transfers = service({ Model }); const populateSchema = { include: [ { service: 'contractors', nameAs: 'contractor', parentField: 'contractorId', childField: '_id' } ] }; export default (app: Application): void => { app.use('/transfers', transfers); app.service('transfers').hooks({ after: { all: [ populate({ schema: populateSchema }), formatDate(), ], }, }) };