mirror of
https://github.com/hotomoe/hotomoe
synced 2024-12-28 13:38:08 +09:00
d071d18dd7
* wip * wip * fix * clean up * Update tsconfig.json * Update activitypub.ts * wip
16 lines
578 B
TypeScript
16 lines
578 B
TypeScript
import { Notes } from '@/models/index.js';
|
|
|
|
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();
|
|
}
|