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/IntegrationHistory.ts

26 lines
993 B

import type { IIntegrationHistory } from '@rocket.chat/core-typings';
import type { IIntegrationHistoryModel } from '@rocket.chat/model-typings';
import type { Db, IndexDescription } from 'mongodb';
import { BaseRaw } from './BaseRaw';
export class IntegrationHistoryRaw extends BaseRaw<IIntegrationHistory> implements IIntegrationHistoryModel {
constructor(db: Db) {
super(db, 'integration_history');
}
protected modelIndexes(): IndexDescription[] {
return [
{ key: { 'integration._id': 1, 'integration._createdBy._id': 1 } },
{ key: { _updatedAt: 1 }, expireAfterSeconds: 30 * 24 * 60 * 60 },
];
}
removeByIntegrationId(integrationId: string): ReturnType<BaseRaw<IIntegrationHistory>['deleteMany']> {
return this.deleteMany({ 'integration._id': integrationId });
}
findOneByIntegrationIdAndHistoryId(integrationId: string, historyId: string): Promise<IIntegrationHistory | null> {
return this.findOne({ 'integration._id': integrationId, '_id': historyId });
}
}