This commit is contained in:
tamaina 2021-09-12 22:56:55 +09:00
parent 3d54fb24d5
commit 4dfebbd0fe

View file

@ -1,14 +1,12 @@
import { EntityRepository, Repository } from 'typeorm'; import { EntityRepository, Repository } from 'typeorm';
import { Hashtag } from '@/models/entities/hashtag'; import { Hashtag } from '@/models/entities/hashtag';
import { SchemaType } from '@/misc/schema'; import { Packed } from '@/misc/schema';
export type PackedHashtag = SchemaType<typeof packedHashtagSchema>;
@EntityRepository(Hashtag) @EntityRepository(Hashtag)
export class HashtagRepository extends Repository<Hashtag> { export class HashtagRepository extends Repository<Hashtag> {
public async pack( public async pack(
src: Hashtag, src: Hashtag,
): Promise<PackedHashtag> { ): Promise<Packed<'Hashtag'>> {
return { return {
tag: src.name, tag: src.name,
mentionedUsersCount: src.mentionedUsersCount, mentionedUsersCount: src.mentionedUsersCount,