This commit is contained in:
tamaina 2021-09-12 23:08:10 +09:00
parent c71844c292
commit 77ed1d7dc4
1 changed files with 2 additions and 4 deletions

View File

@ -1,14 +1,12 @@
import { EntityRepository, Repository } from 'typeorm'; import { EntityRepository, Repository } from 'typeorm';
import { Emoji } from '@/models/entities/emoji'; import { Emoji } from '@/models/entities/emoji';
import { SchemaType } from '@/misc/schema'; import { Packed } from '@/misc/schema';
export type PackedEmoji = SchemaType<typeof packedEmojiSchema>;
@EntityRepository(Emoji) @EntityRepository(Emoji)
export class EmojiRepository extends Repository<Emoji> { export class EmojiRepository extends Repository<Emoji> {
public async pack( public async pack(
src: Emoji['id'] | Emoji, src: Emoji['id'] | Emoji,
): Promise<PackedEmoji> { ): Promise<Packed<'Emoji'>> {
const emoji = typeof src === 'object' ? src : await this.findOneOrFail(src); const emoji = typeof src === 'object' ? src : await this.findOneOrFail(src);
return { return {