From 6c003cb25f5b978f3533a6c542a6c4703a1ef4d8 Mon Sep 17 00:00:00 2001 From: Paula Rinta-Harri Date: Wed, 29 Mar 2023 16:10:53 +0300 Subject: [PATCH] Fix Kuksa parameters to match with new response (#61) --- src/auth.js | 4 ++-- src/groups.js | 8 ++++---- src/profile.js | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/auth.js b/src/auth.js index 7dd1135..47c5e7e 100644 --- a/src/auth.js +++ b/src/auth.js @@ -54,8 +54,8 @@ module.exports.configurePassport = async (clientUrl) => { ) let ageGroup = 4 //Sudenpennut - if (memberData.age_groupId !== null) { - ageGroup = memberData.age_groupId + if (memberData.ageGroupId !== null) { + ageGroup = memberData.ageGroupId } scout.canMarkDone = !restrictedAgeGroups.includes(ageGroup) diff --git a/src/groups.js b/src/groups.js index a6afed3..8bb2bf8 100644 --- a/src/groups.js +++ b/src/groups.js @@ -28,7 +28,7 @@ async function getMemberData(groupMembers) { {}, { memberId: groupMember.id.id, - isGroupLeader: groupMember.is_leader, + isGroupLeader: groupMember.isLeader, memberName: groupMember.name.firstname + ' ' + groupMember.name.lastname, memberTasks: taskEntries, @@ -60,17 +60,17 @@ async function getAllGroups(userNumber) { const memberData = await getMemberData(groupMembers) const ageGroupId = (memberData[0] && - (await getMember(memberData[0].memberId)).age_groupId) || + (await getMember(memberData[0].memberId)).ageGroupId) || 4 return Object.assign( {}, { id: group.id, name: group.name, - ageGroup: groupInfo.age_groups[0], + ageGroup: groupInfo.ageGroups[0], ageGroupId, troop: groupInfo.troops.filter( - (troop) => troop.id === member.default_troop_id + (troop) => troop.id === member.defaultTroopId ), members: memberData, } diff --git a/src/profile.js b/src/profile.js index d2d6350..6e548fc 100644 --- a/src/profile.js +++ b/src/profile.js @@ -8,12 +8,12 @@ export async function getProfile(userNumber) { {}, { name: `${member.name.firstname} ${member.name.lastname}`, - defaultTroopId: member.default_troop_id, - ageGroupId: member.age_groupId || 4, - ageGroup: member.age_group || 'Sudenpennut', + defaultTroopId: member.defaultTroopId, + ageGroupId: member.ageGroupId || 4, + ageGroup: member.ageGroup || 'Sudenpennut', language: 'fi', troops: member.troops, - isLeader: member.is_leader || false, + isLeader: member.isLeader || false, image: memberImage, } )