mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-19 11:30:32 +01:00
d071d18dd7
* wip * wip * fix * clean up * Update tsconfig.json * Update activitypub.ts * wip
20 lines
665 B
TypeScript
20 lines
665 B
TypeScript
import { EntityRepository, Repository } from 'typeorm';
|
|
import { FollowRequest } from '@/models/entities/follow-request.js';
|
|
import { Users } from '../index.js';
|
|
import { User } from '@/models/entities/user.js';
|
|
|
|
@EntityRepository(FollowRequest)
|
|
export class FollowRequestRepository extends Repository<FollowRequest> {
|
|
public async pack(
|
|
src: FollowRequest['id'] | FollowRequest,
|
|
me?: { id: User['id'] } | null | undefined
|
|
) {
|
|
const request = typeof src === 'object' ? src : await this.findOneOrFail(src);
|
|
|
|
return {
|
|
id: request.id,
|
|
follower: await Users.pack(request.followerId, me),
|
|
followee: await Users.pack(request.followeeId, me),
|
|
};
|
|
}
|
|
}
|