mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-15 04:43:08 +02:00
1c67c26bd8
* wip * wip * wip * Update following.ts * wip * wip * wip * Update resolve-user.ts * maxQueryExecutionTime * wip * wip
19 lines
627 B
TypeScript
19 lines
627 B
TypeScript
import { db } from '@/db/postgre.js';
|
|
import { FollowRequest } from '@/models/entities/follow-request.js';
|
|
import { Users } from '../index.js';
|
|
import { User } from '@/models/entities/user.js';
|
|
|
|
export const FollowRequestRepository = db.getRepository(FollowRequest).extend({
|
|
async pack(
|
|
src: FollowRequest['id'] | FollowRequest,
|
|
me?: { id: User['id'] } | null | undefined
|
|
) {
|
|
const request = typeof src === 'object' ? src : await this.findOneByOrFail({ id: src });
|
|
|
|
return {
|
|
id: request.id,
|
|
follower: await Users.pack(request.followerId, me),
|
|
followee: await Users.pack(request.followeeId, me),
|
|
};
|
|
},
|
|
});
|