mirror of
https://github.com/sim1222/misskey.git
synced 2025-08-07 01:04:03 +09:00
15
packages/backend/src/misc/count-same-renotes.ts
Normal file
15
packages/backend/src/misc/count-same-renotes.ts
Normal file
@ -0,0 +1,15 @@
|
||||
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();
|
||||
}
|
Reference in New Issue
Block a user