feature/fitlien-828 (#119)
All checks were successful
Deploy FitLien services to Dev / Deploy to Dev (push) Successful in 3m29s

Reviewed-on: #119
Co-authored-by: Sharon Dcruz <sharondcruz@cosq.net>
Co-committed-by: Sharon Dcruz <sharondcruz@cosq.net>
This commit is contained in:
Sharon Dcruz 2025-09-19 11:08:57 +00:00 committed by Dhansh A S
parent d492f660f5
commit bf94866fbf

View File

@ -24,7 +24,7 @@ interface MembershipData {
} }
interface ClientFields { interface ClientFields {
fields?: { [key: string]: string }; fields?: { [key: string]: any };
[key: string]: any; [key: string]: any;
} }
@ -51,7 +51,7 @@ interface CacheEntry {
updatedAt?: string | null; updatedAt?: string | null;
[key: string]: any; [key: string]: any;
}; };
fields: { [key: string]: string }; fields: { [key: string]: any };
renewalDate?: string | null; renewalDate?: string | null;
trainerAssignments: any[]; trainerAssignments: any[];
timeSlots: any[]; timeSlots: any[];
@ -380,13 +380,13 @@ async function generateCacheEntry(
if (!clientFieldsSnapshot.empty) { if (!clientFieldsSnapshot.empty) {
const fieldDoc = clientFieldsSnapshot.docs[0]; const fieldDoc = clientFieldsSnapshot.docs[0];
const fieldData = fieldDoc.data() as ClientFields; const fieldData = fieldDoc.data() as ClientFields;
fields = {
"first-name": fieldData.fields?.["first-name"] || "", fields = { ...fieldData.fields };
"last-name": fieldData.fields?.["last-name"] || "", Object.keys(fieldData).forEach((key) => {
"email": fieldData.fields?.["email"] || "", if (key !== "fields" && !fields[key]) {
"phone-number": fieldData.fields?.["phone-number"] || "", fields[key] = fieldData[key];
"alternate-contact": fieldData.fields?.["alternate-contact"] || "", }
}; });
} }
} catch (error) { } catch (error) {
logger.error(`Error getting fields for user ${userId}:`, error); logger.error(`Error getting fields for user ${userId}:`, error);