mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2024-11-16 21:06:27 +01:00
16 lines
559 B
TypeScript
16 lines
559 B
TypeScript
|
import { Notes } from '../models';
|
||
|
|
||
|
export default async function(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();
|
||
|
}
|