This commit is contained in:
tamaina 2021-09-12 23:06:27 +09:00
parent 3bf7e4bf02
commit 3a4e3d78b2
1 changed files with 2 additions and 4 deletions

View File

@ -1,16 +1,14 @@
import { EntityRepository, Repository } from 'typeorm'; import { EntityRepository, Repository } from 'typeorm';
import { Clip } from '@/models/entities/clip'; import { Clip } from '@/models/entities/clip';
import { SchemaType } from '@/misc/schema'; import { Packed } from '@/misc/schema';
import { Users } from '../index'; import { Users } from '../index';
import { awaitAll } from '@/prelude/await-all'; import { awaitAll } from '@/prelude/await-all';
export type PackedClip = SchemaType<typeof packedClipSchema>;
@EntityRepository(Clip) @EntityRepository(Clip)
export class ClipRepository extends Repository<Clip> { export class ClipRepository extends Repository<Clip> {
public async pack( public async pack(
src: Clip['id'] | Clip, src: Clip['id'] | Clip,
): Promise<PackedClip> { ): Promise<Packed<'Clip'>> {
const clip = typeof src === 'object' ? src : await this.findOneOrFail(src); const clip = typeof src === 'object' ? src : await this.findOneOrFail(src);
return await awaitAll({ return await awaitAll({