Feat: コントロールパネル内のファイル一覧でファイル名と説明で検索できるように(#14789)
This commit is contained in:
parent
58419e1621
commit
0c59948828
2 changed files with 24 additions and 0 deletions
|
|
@ -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<typeof meta, typeof paramDef> { // 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 });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue