File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -199,15 +199,15 @@ export function createAirtableClient(apiKey: string, baseId: string) {
199199 }
200200
201201 /**
202- * Check if email exists in Apprentices table
202+ * Check if email exists in Apprentices table (case-insensitive)
203203 * Note: filterByFormula requires field NAME "Learner email" - this would break if renamed in Airtable
204204 */
205205 async function findApprenticeByEmail ( email : string ) : Promise < boolean > {
206206 const apprenticesTable = base ( TABLES . APPRENTICES ) ;
207207
208208 const apprenticeRecords = await apprenticesTable
209209 . select ( {
210- filterByFormula : `{Learner email} = "${ email } "` ,
210+ filterByFormula : `LOWER( {Learner email}) = LOWER( "${ email } ") ` ,
211211 maxRecords : 1 ,
212212 returnFieldsByFieldId : true ,
213213 } )
@@ -224,7 +224,7 @@ export function createAirtableClient(apiKey: string, baseId: string) {
224224
225225 const records = await apprenticesTable
226226 . select ( {
227- filterByFormula : `{Learner email} = "${ email } "` ,
227+ filterByFormula : `LOWER( {Learner email}) = LOWER( "${ email } ") ` ,
228228 maxRecords : 1 ,
229229 returnFieldsByFieldId : true ,
230230 } )
You can’t perform that action at this time.
0 commit comments