mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-13 14:53:08 +02:00
19 lines
563 B
TypeScript
19 lines
563 B
TypeScript
import { EntityRepository, Repository } from 'typeorm';
|
|
import { FollowRequest } from '../entities/follow-request';
|
|
import { Users } from '..';
|
|
|
|
@EntityRepository(FollowRequest)
|
|
export class FollowRequestRepository extends Repository<FollowRequest> {
|
|
public async pack(
|
|
src: FollowRequest['id'] | FollowRequest,
|
|
me?: any
|
|
) {
|
|
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),
|
|
};
|
|
}
|
|
}
|