following

This commit is contained in:
tamaina 2021-09-12 22:55:21 +09:00
parent 8f67adb817
commit fad785bebf
1 changed files with 2 additions and 4 deletions

View File

@ -2,7 +2,7 @@ import { EntityRepository, Repository } from 'typeorm';
import { Users } from '../index'; import { Users } from '../index';
import { Following } from '@/models/entities/following'; import { Following } from '@/models/entities/following';
import { awaitAll } from '@/prelude/await-all'; import { awaitAll } from '@/prelude/await-all';
import { SchemaType } from '@/misc/schema'; import { Packed } from '@/misc/schema';
import { User } from '@/models/entities/user'; import { User } from '@/models/entities/user';
type LocalFollowerFollowing = Following & { type LocalFollowerFollowing = Following & {
@ -29,8 +29,6 @@ type RemoteFolloweeFollowing = Following & {
followeeSharedInbox: string; followeeSharedInbox: string;
}; };
export type PackedFollowing = SchemaType<typeof packedFollowingSchema>;
@EntityRepository(Following) @EntityRepository(Following)
export class FollowingRepository extends Repository<Following> { export class FollowingRepository extends Repository<Following> {
public isLocalFollower(following: Following): following is LocalFollowerFollowing { public isLocalFollower(following: Following): following is LocalFollowerFollowing {
@ -56,7 +54,7 @@ export class FollowingRepository extends Repository<Following> {
populateFollowee?: boolean; populateFollowee?: boolean;
populateFollower?: boolean; populateFollower?: boolean;
} }
): Promise<PackedFollowing> { ): Promise<Packed<'Following'>> {
const following = typeof src === 'object' ? src : await this.findOneOrFail(src); const following = typeof src === 'object' ? src : await this.findOneOrFail(src);
if (opts == null) opts = {}; if (opts == null) opts = {};