chore: Include test case title query in filters to improve UI consistency (#284)

This commit is contained in:
kimatata
2025-09-23 11:22:14 +09:00
committed by GitHub
parent 81805c605a
commit 0a8cccfad4
12 changed files with 164 additions and 215 deletions

View File

@@ -11,7 +11,7 @@ export default function (sequelize) {
const Case = defineCase(sequelize, DataTypes);
router.get('/', verifySignedIn, verifyProjectVisibleFromFolderId, async (req, res) => {
const { folderId, priority, type, q } = req.query;
const { folderId, title, priority, type } = req.query;
if (!folderId) {
return res.status(400).json({ error: 'folderId is required' });
@@ -22,15 +22,15 @@ export default function (sequelize) {
folderId: folderId,
};
if (q) {
const searchTerm = q.trim();
if (title) {
const searchTerm = title.trim();
if (searchTerm.length > 100) {
return res.status(400).json({ error: 'Search term too long' });
return res.status(400).json({ error: 'too long title param' });
}
if (searchTerm.length >= 2) {
whereClause[Op.or] = [{ title: { [Op.like]: `%${q}%` } }];
if (searchTerm.length >= 1) {
whereClause[Op.or] = [{ title: { [Op.like]: `%${searchTerm}%` } }];
}
}