mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-12-03 07:07:54 -07:00
16 lines
501 B
TypeScript
16 lines
501 B
TypeScript
import type { User } from "@/models/entities/user.js";
|
|
import { MutedNotes } from "@/models/index.js";
|
|
import type { SelectQueryBuilder } from "typeorm";
|
|
|
|
export function generateMutedNoteQuery(
|
|
q: SelectQueryBuilder<any>,
|
|
me: { id: User["id"] },
|
|
) {
|
|
const mutedQuery = MutedNotes.createQueryBuilder("muted")
|
|
.select("muted.noteId")
|
|
.where("muted.userId = :userId", { userId: me.id });
|
|
|
|
q.andWhere(`note.id NOT IN (${mutedQuery.getQuery()})`);
|
|
|
|
q.setParameters(mutedQuery.getParameters());
|
|
}
|