Fixed 267U.pre2
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { Notes } from "../models/index.js";
|
||||
export async function countSameRenotes(userId, renoteId, excludeNoteId, groupId) {
|
||||
// 指定したユーザーの指定したノートのリノートがいくつあるか数える
|
||||
const query = Notes.createQueryBuilder("note").where("note.userId = :userId", {
|
||||
userId
|
||||
}).andWhere("note.renoteId = :renoteId", {
|
||||
renoteId
|
||||
});
|
||||
if (groupId) {
|
||||
query.andWhere("note.groupId = :groupId", {
|
||||
groupId
|
||||
});
|
||||
} else {
|
||||
query.andWhere("note.groupId IS NULL");
|
||||
}
|
||||
// 指定した投稿を除く
|
||||
if (excludeNoteId) {
|
||||
query.andWhere("note.id != :excludeNoteId", {
|
||||
excludeNoteId
|
||||
});
|
||||
}
|
||||
return await query.getCount();
|
||||
}
|
||||
Reference in New Issue
Block a user