mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-14 08:33:09 +02:00
0e4a111f81
Resolve #7779
15 lines
575 B
TypeScript
15 lines
575 B
TypeScript
import { Notes } from '@/models/index';
|
|
|
|
export async function countSameRenotes(userId: string, renoteId: string, excludeNoteId: string | undefined): Promise<number> {
|
|
// 指定したユーザーの指定したノートのリノートがいくつあるか数える
|
|
const query = Notes.createQueryBuilder('note')
|
|
.where('note.userId = :userId', { userId })
|
|
.andWhere('note.renoteId = :renoteId', { renoteId });
|
|
|
|
// 指定した投稿を除く
|
|
if (excludeNoteId) {
|
|
query.andWhere('note.id != :excludeNoteId', { excludeNoteId });
|
|
}
|
|
|
|
return await query.getCount();
|
|
}
|