import { DataSource } from 'typeorm';
import { CustomEmojiEntity } from '../../../entities';
import { rowToCustomEmoji } from '../../mappers';

export async function handleGetCustomEmojis(dataSource: DataSource) {
  const rows = await dataSource.getRepository(CustomEmojiEntity).find({ order: { updatedAt: 'DESC' } });

  return rows.map(rowToCustomEmoji);
}
