This commit is contained in:
syuilo
2020-02-26 07:56:32 +09:00
parent f6c376f20d
commit 7121bdef6b
3 changed files with 5 additions and 5 deletions

View File

@ -0,0 +1,15 @@
import { Notes } from '../models';
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();
}