Improve photo search: include path, student name, and group name in search query

This commit is contained in:
dev
2026-11-01 21:35:53 +03:00
parent 773e092253
commit 574f1bc204
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -11446,7 +11446,7 @@ app.get('/api/photos', requireAuth, async (req, res) => {
try {
const conditions = [];
const params = [];
if (search) { params.push(`%${search}%`); conditions.push(`t.title ILIKE $${params.length}`); }
if (search) { params.push(`%${search}%`); conditions.push(`(t.title ILIKE $${params.length} OR t.path ILIKE $${params.length} OR COALESCE(t.student_name, '') ILIKE $${params.length} OR COALESCE(t.group_name, '') ILIKE $${params.length})`); }
if (student_name) { params.push(student_name); conditions.push(`t.student_name = $${params.length}`); }
if (group_id) { params.push(group_id); conditions.push(`t.group_id = $${params.length}`); }
if (student_id) {