mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-14 21:53:08 +02:00
987168b863
* wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip
20 lines
617 B
TypeScript
20 lines
617 B
TypeScript
import { EntityRepository, Repository } from 'typeorm';
|
|
import { FollowRequest } from '../entities/follow-request';
|
|
import { Users } from '..';
|
|
import { ensure } from '../../prelude/ensure';
|
|
|
|
@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.findOne(src).then(ensure);
|
|
|
|
return {
|
|
id: request.id,
|
|
follower: await Users.pack(request.followerId, me),
|
|
followee: await Users.pack(request.followeeId, me),
|
|
};
|
|
}
|
|
}
|