From c64694cd2b8fd8f7cc6d5f431d54366f350779f7 Mon Sep 17 00:00:00 2001
From: tawoyinfa <mail4taiwo@yahoo.co.uk>
Date: Mon, 3 Jul 2023 18:44:42 +0100
Subject: [PATCH] Fix #18 - Display session activity log when username contains
 capital letters

---
 amplify/backend/function/teamgetLogs/src/index.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/amplify/backend/function/teamgetLogs/src/index.js b/amplify/backend/function/teamgetLogs/src/index.js
index b64c430d..14712e2a 100644
--- a/amplify/backend/function/teamgetLogs/src/index.js
+++ b/amplify/backend/function/teamgetLogs/src/index.js
@@ -141,7 +141,7 @@ const start_query = async (event) => {
   const role = event["role"]["S"];
   try {
     const input = {
-      QueryStatement: `SELECT eventID, eventName, eventSource, eventTime FROM ${EventDataStore} WHERE eventTime > '${startTime}' AND eventTime < '${endTime}' AND useridentity.principalId LIKE '%:${username}%' AND useridentity.sessionContext.sessionIssuer.arn LIKE '%${role}%' AND recipientAccountId='${accountId}'`,
+      QueryStatement: `SELECT eventID, eventName, eventSource, eventTime FROM ${EventDataStore} WHERE eventTime > '${startTime}' AND eventTime < '${endTime}' AND lower(useridentity.principalId) LIKE '%:${username}%' AND useridentity.sessionContext.sessionIssuer.arn LIKE '%${role}%' AND recipientAccountId='${accountId}'`,
     };
     const command = new StartQueryCommand(input);
     const response = await client.send(command);