Files
Toju/electron/cqrs/commands/handlers/deleteMessage.ts

10 lines
371 B
TypeScript

import { DataSource } from 'typeorm';
import { MessageEntity } from '../../../entities';
import { DeleteMessageCommand } from '../../types';
export async function handleDeleteMessage(command: DeleteMessageCommand, dataSource: DataSource): Promise<void> {
const repo = dataSource.getRepository(MessageEntity);
await repo.delete({ id: command.payload.messageId });
}