@@ -26,7 +26,9 @@ export class IncidentService {
2626 . innerJoin ( "incident_types" , "incident_types.id" , "incidents.incident_type_id" )
2727 . innerJoin ( "incident_statuses" , "incident_statuses.code" , "incidents.status_code" )
2828 . innerJoin ( "departments" , "departments.code" , "incidents.department_code" )
29- . whereRaw ( `"incidents"."id" IN (SELECT "incident_id" FROM "incident_users_view" WHERE "user_email" = ?)` , [ email ] )
29+ . whereRaw ( `"incidents"."id" IN (SELECT "incident_id" FROM "incident_users_view" WHERE LOWER("user_email") = ?)` , [
30+ email . toLowerCase ( ) ,
31+ ] )
3032 . whereNot ( "incident_types.name" , "inspection" )
3133 . modify ( where )
3234 . count ( "* as count" )
@@ -46,7 +48,9 @@ export class IncidentService {
4648 . innerJoin ( "incident_statuses" , "incident_statuses.code" , "incidents.status_code" )
4749 . innerJoin ( "departments" , "departments.code" , "incidents.department_code" )
4850 . innerJoin ( "locations" , "incidents.location_code" , "locations.code" )
49- . whereRaw ( `"incidents"."id" IN (SELECT "incident_id" FROM "incident_users_view" WHERE "user_email" = ?)` , [ email ] )
51+ . whereRaw ( `"incidents"."id" IN (SELECT "incident_id" FROM "incident_users_view" WHERE LOWER("user_email") = ?)` , [
52+ email . toLowerCase ( ) ,
53+ ] )
5054 . whereNot ( "incident_types.name" , "inspection" )
5155 . select < Incident > (
5256 "incidents.*" ,
@@ -110,14 +114,14 @@ export class IncidentService {
110114
111115 async getByReportingEmail ( email : string ) : Promise < Incident [ ] > {
112116 return db < Incident > ( "incidents" )
113- . whereILike ( "incident_users_view.user_email" , email . toLowerCase ( ) )
114117 . where ( "incident_users_view.reason" , "reporter" )
115118 . whereNotIn ( "status_code" , [ "Closed" , "Dup" , "NoAct" ] )
116119 . whereNot ( "incident_types.name" , "inspection" )
117120 . innerJoin ( "incident_users_view" , "incidents.id" , "incident_users_view.incident_id" )
118121 . innerJoin ( "incident_types" , "incident_types.id" , "incidents.incident_type_id" )
119122 . innerJoin ( "incident_statuses" , "incident_statuses.code" , "incidents.status_code" )
120123 . innerJoin ( "departments" , "departments.code" , "incidents.department_code" )
124+ . whereRaw ( `LOWER("incident_users_view"."user_email") = '${ email . toLowerCase ( ) } '` )
121125 . select (
122126 "incidents.*" ,
123127 "incident_types.name as incident_type_name" ,
@@ -129,14 +133,14 @@ export class IncidentService {
129133
130134 async getBySupervisorEmail ( email : string ) : Promise < Incident [ ] > {
131135 return db < Incident > ( "incidents" )
132- . whereILike ( "incident_users_view.user_email" , email . toLowerCase ( ) )
133136 . where ( "incident_users_view.reason" , "supervisor" )
134137 . whereNot ( "incident_types.name" , "inspection" )
135138 . whereNotIn ( "status_code" , [ "Closed" , "Dup" , "NoAct" ] )
136139 . innerJoin ( "incident_users_view" , "incidents.id" , "incident_users_view.incident_id" )
137140 . innerJoin ( "incident_types" , "incident_types.id" , "incidents.incident_type_id" )
138141 . innerJoin ( "incident_statuses" , "incident_statuses.code" , "incidents.status_code" )
139142 . innerJoin ( "departments" , "departments.code" , "incidents.department_code" )
143+ . whereRaw ( `LOWER("incident_users_view"."user_email") = '${ email . toLowerCase ( ) } '` )
140144 . select (
141145 "incidents.*" ,
142146 "incident_types.name as incident_type_name" ,
0 commit comments