import { DataSource } from 'typeorm'; import { CustomEmojiEntity } from '../../../entities'; import { SaveCustomEmojiCommand } from '../../types'; export async function handleSaveCustomEmoji(command: SaveCustomEmojiCommand, dataSource: DataSource): Promise { const { emoji } = command.payload; await dataSource.getRepository(CustomEmojiEntity).save({ id: emoji.id, name: emoji.name, creatorUserId: emoji.creatorUserId, dataUrl: emoji.dataUrl, hash: emoji.hash, mime: emoji.mime, size: emoji.size, createdAt: emoji.createdAt, updatedAt: emoji.updatedAt }); }