The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/server/models/raw/Reports.ts

21 lines
752 B

import type { IMessage, IReport, RocketChatRecordDeleted } from '@rocket.chat/core-typings';
import type { IReportsModel } from '@rocket.chat/model-typings';
import type { Db, Collection } from 'mongodb';
import { BaseRaw } from './BaseRaw';
export class ReportsRaw extends BaseRaw<IReport> implements IReportsModel {
constructor(db: Db, trash?: Collection<RocketChatRecordDeleted<IReport>>) {
super(db, 'reports', trash);
}
createWithMessageDescriptionAndUserId(message: IMessage, description: string, userId: string): ReturnType<BaseRaw<IReport>['insertOne']> {
const record: Pick<IReport, 'message' | 'description' | 'ts' | 'userId'> = {
message,
description,
ts: new Date(),
userId,
};
return this.insertOne(record);
}
}