The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
import { InjectCacheStorage } from 'src/engine/core-modules/cache-storage/decorators/cache-storage.decorator';
import { CacheStorageService } from 'src/engine/core-modules/cache-storage/services/cache-storage.service';
import { CacheStorageNamespace } from 'src/engine/core-modules/cache-storage/types/cache-storage-namespace.enum';
import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator';
import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator';
import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants';
export type MessagingCleanCacheJobData = {
workspaceId: string;
messageChannelId: string;
};
@Processor(MessageQueue.messagingQueue)
export class MessagingCleanCacheJob {
constructor(
@InjectCacheStorage(CacheStorageNamespace.ModuleMessaging)
private readonly cacheStorage: CacheStorageService,
) {}
@Process(MessagingCleanCacheJob.name)
async handle(data: MessagingCleanCacheJobData): Promise<void> {
await this.cacheStorage.mdel([
`messages-to-import:${data.workspaceId}:${data.messageChannelId}`,
`messages-to-import-total:${data.workspaceId}:${data.messageChannelId}`,
`messages-imported:${data.workspaceId}:${data.messageChannelId}`,
]);
}
}