diff --git a/packages/backend/src/server/api/endpoints/admin/drive/files.ts b/packages/backend/src/server/api/endpoints/admin/drive/files.ts index 915d777e77..0ffcdcd6ec 100644 --- a/packages/backend/src/server/api/endpoints/admin/drive/files.ts +++ b/packages/backend/src/server/api/endpoints/admin/drive/files.ts @@ -43,6 +43,8 @@ export const paramDef = { default: null, description: 'The local host is represented with `null`.', }, + name: { type: 'string', nullable: true }, + comment: { type: 'string', nullable: true }, }, required: [], } as const; @@ -81,6 +83,16 @@ export default class extends Endpoint { // eslint- } } + if (ps.name) { + // 前方一致検索(%と_は無害化) + query.andWhere('file.name ilike :name', { name: ps.name.replaceAll('%', '\\%').replaceAll('_', '\\_') + '%' }); + } + + if (ps.comment) { + // 前方一致検索(%と_は無害化) + query.andWhere('file.comment ilike :comment', { comment: ps.comment.replaceAll('%', '\\%').replaceAll('_', '\\_') + '%' }); + } + const files = await query.limit(ps.limit).getMany(); return await this.driveFileEntityService.packMany(files, { detail: true, withUser: true, self: true }); diff --git a/packages/frontend/src/pages/admin/files.vue b/packages/frontend/src/pages/admin/files.vue index 4cc859227f..c13f70a8fe 100644 --- a/packages/frontend/src/pages/admin/files.vue +++ b/packages/frontend/src/pages/admin/files.vue @@ -28,6 +28,14 @@ SPDX-License-Identifier: AGPL-3.0-only +
+ + + + + + +
@@ -51,6 +59,8 @@ const type = ref(null); const searchHost = ref(''); const userId = ref(''); const viewMode = ref('grid'); +const name = ref(''); +const comment = ref(''); const pagination = { endpoint: 'admin/drive/files' as const, limit: 10, @@ -59,6 +69,8 @@ const pagination = { userId: (userId.value && userId.value !== '') ? userId.value : null, origin: origin.value, hostname: (searchHost.value && searchHost.value !== '') ? searchHost.value : null, + name: (name.value && name.value !== '') ? name.value : null, + comment: (comment.value && comment.value !== '') ? comment.value : null, })), };