Created
May 25, 2020 14:21
-
-
Save lkostrowski/102a36ec6b32119557b163f4ea06cba3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const SystemSelectorV2: SystemsSelectorV2 = { | |
getSystemsForTableView: createSelector(getSystemsDomain, (domain) => | |
Object.values(domain.systemsByID).map((normalizedSystem) => { | |
const baseData: SystemModel.SystemsTableRowData = { | |
id: normalizedSystem.id, | |
systemID: normalizedSystem.systemIdentifier, | |
address: normalizedSystem.address, | |
systemType: normalizedSystem.type, | |
customer: null, | |
installer: null, | |
}; | |
return createSelector( | |
...normalizedSystem.users.map((id) => AccountsSelector.getAccountById(id)), | |
(...users): SystemModel.SystemsTableRowData => { | |
return { | |
...baseData, | |
customer: AccountModel.findCustomerInAccounts(users), | |
installer: AccountModel.findInstallerInAccounts(users), | |
}; | |
}, | |
); | |
}), | |
), | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment