Skip to content

Commit

Permalink
Merge pull request #200 from AmbireTech/fix-mapping-func
Browse files Browse the repository at this point in the history
fix: mapCampaignUItoCampaign function
  • Loading branch information
ivopaunov authored Jul 3, 2024
2 parents 072a761 + 7013206 commit 2803ae6
Showing 1 changed file with 17 additions and 28 deletions.
45 changes: 17 additions & 28 deletions src/helpers/createCampaignHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,35 +216,24 @@ type ReducedCampaign = Omit<
>

export const mapCampaignUItoCampaign = (campaignUI: CampaignUI): ReducedCampaign => {
const {
step,
devices,
paymentModel,
autoUTMChecked,
startsAt,
endsAt,
currency,
created,
owner,
validators,
targetingRules,
status,
reviewStatus,
modified,
archived,
createdBy,
lastModifiedBy,
cpmPricingBounds,
ownerHashed,
updated,
asapStartingDate,
draftModified,
...campaign
} = campaignUI

return {
...campaign
const campaign: ReducedCampaign = {
...(campaignUI.id ? { id: campaignUI.id } : {}),
type: campaignUI.type,
outpaceAssetAddr: campaignUI.outpaceAssetAddr,
outpaceAssetDecimals: campaignUI.outpaceAssetDecimals,
outpaceAddr: campaignUI.outpaceAddr,
campaignBudget: campaignUI.campaignBudget,
outpaceChainId: campaignUI.outpaceChainId,
nonce: campaignUI.nonce,
title: campaignUI.title,
adUnits: campaignUI.adUnits,
pricingBounds: campaignUI.pricingBounds,
activeFrom: campaignUI.activeFrom,
activeTo: campaignUI.activeTo,
targetingInput: campaignUI.targetingInput
}

return campaign
}

const removeProperty = (propKey: any, { [propKey]: propValue, ...rest }) => rest
Expand Down

0 comments on commit 2803ae6

Please sign in to comment.