import { DataSource } from 'typeorm'; import { AttachmentEntity } from '../../../entities'; import { DeleteAttachmentsForMessageCommand } from '../../types'; export async function handleDeleteAttachmentsForMessage(command: DeleteAttachmentsForMessageCommand, dataSource: DataSource): Promise { const repo = dataSource.getRepository(AttachmentEntity); await repo.delete({ messageId: command.payload.messageId }); }