Update : API for AssessmenRequest for search feature

This commit is contained in:
percyfikri 2024-10-11 15:30:33 +07:00
parent 447e9ae123
commit 64816b217a

View File

@ -51,7 +51,7 @@ const assessmentRequestRoute = new Hono<HonoEnv>()
and( and(
eq(users.id, userId), eq(users.id, userId),
q && q.trim() !== "" q && q.trim() !== ""
? ilike(sql`${assessments.status}::text`, `%${q}%`) // Cast status to text for ilike ?sql`CAST(${assessments.status} AS TEXT) ILIKE ${'%' + q + '%'}`
: undefined : undefined
) )
) )
@ -76,7 +76,8 @@ const assessmentRequestRoute = new Hono<HonoEnv>()
and( and(
eq(users.id, userId), eq(users.id, userId),
q && q.trim() !== "" q && q.trim() !== ""
? ilike(sql`${assessments.status}::text`, `%${q}%`) // Cast status to text for ilike // ? ilike(sql`${assessments.status}::text`, `%${q}%`) // Cast status to text for ilike
?sql`CAST(${assessments.status} AS TEXT) ILIKE ${'%' + q + '%'}`
: undefined : undefined
) )
) )