import { Provide } from '@midwayjs/decorator'; import { InjectEntityModel } from '@midwayjs/typegoose'; import { ReturnModelType } from '@typegoose/typegoose'; import { BaseService } from 'free-midway-component'; import { ChatRecord } from '../entity/chat/chatRecord.entity'; type modelType = ReturnModelType; @Provide() export class ChatRecordService extends BaseService { @InjectEntityModel(ChatRecord) model: modelType; async toRead(list: Array) { const res = await this.model.updateMany({ _id: list }, { is_read: '1' }); return res; } }