Skip to content

Commit

Permalink
fix: campaign clone (#904)
Browse files Browse the repository at this point in the history
* fix: campaign clone

* fix: add id
  • Loading branch information
IanKrieger authored Sep 27, 2023
1 parent a084df2 commit c92e17b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/form/fragmentUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ export function createAdSetFromFragment(
data: AdSetFragment,
campaignId?: string,
): CreateAdSetInput {
const ads = (data.ads ?? []).filter((ad) => ad.state !== "deleted");

return {
campaignId,
ads: (data.ads ?? [])
.filter((ad) => ad.state !== "deleted")
.map((ad) => ({
creativeId: ad.creative.id,
price: ad.price,
priceType: ad.priceType,
})),
ads: ads.map((ad) => ({
creativeId: ad.creative.id,
creativeSetId: data.id,
})),
price: ads[0].price,
bannedKeywords: data.bannedKeywords,
billingType: data.billingType ?? "cpm",
conversions: (data.conversions ?? []).map((c) => ({
Expand Down
4 changes: 3 additions & 1 deletion src/graphql/types.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c92e17b

Please sign in to comment.