lunbo.js 624 B

12345678910111213141516171819202122
  1. 'use strict';
  2. const assert = require('assert');
  3. const _ = require('lodash');
  4. const moment = require('moment');
  5. const { ObjectId } = require('mongoose').Types;
  6. const { CrudService } = require('naf-framework-mongoose/lib/service');
  7. const { BusinessError, ErrorCode } = require('naf-core').Error;
  8. class LunboService extends CrudService {
  9. constructor(ctx) {
  10. super(ctx, 'lunbo');
  11. this.model = this.ctx.model.Lunbo;
  12. }
  13. async index(data) {
  14. const create_time = moment().format('YYYY-MM-DD');
  15. const res = await this.model.create({ ...data, create_time });
  16. return res;
  17. }
  18. }
  19. module.exports = LunboService;