personroomtalk.js 678 B

1234567891011121314151617181920212223242526
  1. 'use strict';
  2. // const assert = require('assert');
  3. // const _ = require('lodash');
  4. // const { ObjectId } = require('mongoose').Types;
  5. const { CrudService } = require('naf-framework-mongoose/lib/service');
  6. // const { BusinessError, ErrorCode } = require('naf-core').Error;
  7. class PersonroomService extends CrudService {
  8. constructor(ctx) {
  9. super(ctx, 'person_room_talk');
  10. this.model = this.ctx.model.Personroomtalk;
  11. }
  12. async delete(params) {
  13. const talk = await this.model.findOne({ pr_id: params.id });
  14. return talk.delete();
  15. }
  16. async countroom() {
  17. const total = await this.model.count();
  18. return total;
  19. }
  20. }
  21. module.exports = PersonroomService;