const Component = require(`vn-print/core/component`); const emailBody = new Component('email-body'); const models = require('vn-loopback/server/server').models; module.exports = { name: 'modified-collection-volumetry', components: { 'email-body': emailBody.build(), }, async serverPrefetch() { this.username = (this.data.userFk) ? await this.getUsername(this.data.userFk) : 'system'; }, methods: { async getUsername(id) { const account = await models.VnUser.findById(id); return account.name; } }, props: { data: { type: Object, required: true } } };