Skip to content

Commit

Permalink
chore: add type for accumulator in get profile service
Browse files Browse the repository at this point in the history
  • Loading branch information
AbhishekA1509 committed Jan 29, 2024
1 parent 303b73a commit 5654ee9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Pages/GlobalConfigurations/BuildInfra/services.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
CreateBuildInfraServiceConfigurationType,
GetBuildInfraProfileType,
UpdateBuildInfraProfileType,
BuildInfraConfigurationMapWithoutDefaultType,
} from './types'

const getBaseProfileObject = (
Expand Down Expand Up @@ -45,13 +46,13 @@ export const getTransformedBuildInfraProfileResponse = ({
defaultConfigurations?.reduce((acc, configuration) => {
acc[configuration.key] = configuration
return acc
}, {}) ?? {}
}, {} as BuildInfraConfigurationMapWithoutDefaultType) ?? ({} as BuildInfraConfigurationMapWithoutDefaultType)

const profileConfigurations =
profile?.configurations?.reduce((acc, configuration) => {
acc[configuration.key] = configuration
return acc
}, {}) ?? {}
}, {} as BuildInfraConfigurationMapWithoutDefaultType) ?? ({} as BuildInfraConfigurationMapWithoutDefaultType)

const configurations = Object.keys(defaultConfigurationsMap).reduce((acc, key) => {
const defaultConfiguration: BuildInfraConfigurationType = defaultConfigurationsMap[key]
Expand Down
4 changes: 4 additions & 0 deletions src/Pages/GlobalConfigurations/BuildInfra/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ export interface BuildInfraConfigurationType extends BuildInfraConfigValuesType,
defaultValue: BuildInfraConfigValuesType
}

export type BuildInfraConfigurationMapWithoutDefaultType = {
[key in BuildInfraConfigTypes]: BuildInfraConfigValuesType & BuildInfraProfileConfigBase
}

export type BuildInfraConfigurationMapType = {
[key in BuildInfraConfigTypes]: BuildInfraConfigurationType
}
Expand Down
1 change: 1 addition & 0 deletions src/Pages/GlobalConfigurations/BuildInfra/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ export const useBuildInfraForm = ({
currentInputErrors[BuildInfraConfigTypes.CPU_REQUEST] = request.message
break
}

case BuildInfraConfigTypes.CPU_REQUEST: {
currentConfiguration[BuildInfraConfigTypes.CPU_REQUEST] = {
...currentConfiguration[BuildInfraConfigTypes.CPU_REQUEST],
Expand Down

0 comments on commit 5654ee9

Please sign in to comment.