gallery-post

This commit is contained in:
tamaina 2021-09-12 23:07:45 +09:00
parent 3a4e3d78b2
commit c71844c292

View file

@ -1,18 +1,16 @@
import { EntityRepository, Repository } from 'typeorm';
import { GalleryPost } from '@/models/entities/gallery-post';
import { SchemaType } from '@/misc/schema';
import { Packed } from '@/misc/schema';
import { Users, DriveFiles, GalleryLikes } from '../index';
import { awaitAll } from '@/prelude/await-all';
import { User } from '@/models/entities/user';
export type PackedGalleryPost = SchemaType<typeof packedGalleryPostSchema>;
@EntityRepository(GalleryPost)
export class GalleryPostRepository extends Repository<GalleryPost> {
public async pack(
src: GalleryPost['id'] | GalleryPost,
me?: { id: User['id'] } | null | undefined,
): Promise<PackedGalleryPost> {
): Promise<Packed<'GalleryPost'>> {
const meId = me ? me.id : null;
const post = typeof src === 'object' ? src : await this.findOneOrFail(src);