summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/endpoints/clips/notes.ts
diff options
context:
space:
mode:
authorsyuilo <4439005+syuilo@users.noreply.github.com>2025-06-29 15:10:51 +0900
committersyuilo <4439005+syuilo@users.noreply.github.com>2025-06-29 15:10:51 +0900
commit8bc822d829b823ec53c5e16d180f1898755df6c3 (patch)
treeada87a95fd3ee60720303d2d68598aefd4a9f580 /packages/backend/src/server/api/endpoints/clips/notes.ts
parentenhance(frontend): ファイルアップロード時にセンシティブ設... (diff)
downloadmisskey-8bc822d829b823ec53c5e16d180f1898755df6c3.tar.gz
misskey-8bc822d829b823ec53c5e16d180f1898755df6c3.tar.bz2
misskey-8bc822d829b823ec53c5e16d180f1898755df6c3.zip
feat(backend): クリップ内でノートを検索できるように
Diffstat (limited to 'packages/backend/src/server/api/endpoints/clips/notes.ts')
-rw-r--r--packages/backend/src/server/api/endpoints/clips/notes.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/packages/backend/src/server/api/endpoints/clips/notes.ts b/packages/backend/src/server/api/endpoints/clips/notes.ts
index 19302b1f8d..ecd0afc386 100644
--- a/packages/backend/src/server/api/endpoints/clips/notes.ts
+++ b/packages/backend/src/server/api/endpoints/clips/notes.ts
@@ -4,11 +4,13 @@
*/
import { Inject, Injectable } from '@nestjs/common';
+import { Brackets } from 'typeorm';
import { Endpoint } from '@/server/api/endpoint-base.js';
import type { NotesRepository, ClipsRepository, ClipNotesRepository } from '@/models/_.js';
import { QueryService } from '@/core/QueryService.js';
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
import { DI } from '@/di-symbols.js';
+import { sqlLikeEscape } from '@/misc/sql-like-escape.js';
import { ApiError } from '../../error.js';
export const meta = {
@@ -46,6 +48,7 @@ export const paramDef = {
untilId: { type: 'string', format: 'misskey:id' },
sinceDate: { type: 'integer' },
untilDate: { type: 'integer' },
+ search: { type: 'string', minLength: 1, maxLength: 100, nullable: true },
},
required: ['clipId'],
} as const;
@@ -97,6 +100,15 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
this.queryService.generateBlockedUserQueryForNotes(query, me, { noteColumn: 'renote' });
}
+ if (ps.search != null) {
+ for (const word of ps.search!.trim().split(' ')) {
+ query.andWhere(new Brackets(qb => {
+ qb.orWhere('note.text ILIKE :search', { search: `%${sqlLikeEscape(word)}%` });
+ qb.orWhere('note.cw ILIKE :search', { search: `%${sqlLikeEscape(word)}%` });
+ }));
+ }
+ }
+
const notes = await query
.limit(ps.limit)
.getMany();