123456789101112131415161718192021 |
- 'use strict';
- const { CrudService } = require('naf-framework-mongoose-free/lib/service');
- const template = require('../public/table-template');
- class TableService extends CrudService {
- constructor(ctx) {
- super(ctx, 'table');
- this.model = this.ctx.model.Table;
- }
- async toExport({ ids }) {
- const res = await this.model.find({ _id: { $in: ids } });
- const data = {};
- for (const i of res) {
- const d = template(i);
- data[i.name_zh ? i.name_zh : i.name] = d;
- }
- return data;
- }
- }
- module.exports = TableService;
|