From c92e17b2ced2fb56f3c77494571f028c0e39fb74 Mon Sep 17 00:00:00 2001 From: Ian Krieger <48930920+IanKrieger@users.noreply.github.com> Date: Wed, 27 Sep 2023 08:58:51 -0400 Subject: [PATCH 1/2] fix: campaign clone (#904) * fix: campaign clone * fix: add id --- src/form/fragmentUtil.ts | 14 +++++++------- src/graphql/types.ts | 4 +++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/form/fragmentUtil.ts b/src/form/fragmentUtil.ts index d95fd1ea..2892fac8 100644 --- a/src/form/fragmentUtil.ts +++ b/src/form/fragmentUtil.ts @@ -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) => ({ diff --git a/src/graphql/types.ts b/src/graphql/types.ts index 0c03884f..4c5763b5 100644 --- a/src/graphql/types.ts +++ b/src/graphql/types.ts @@ -82,13 +82,15 @@ export enum CampaignSource { export type ChangeFilter = { /** exclude all changes whose time range is completely before this time */ - created?: InputMaybe; + createdAfter?: InputMaybe; /** include changes made by system user */ includeSystemUser?: InputMaybe; /** limit the amount of results returned */ limit?: InputMaybe; /** only include changes for this reference id */ referenceId?: InputMaybe; + /** only include changes for this set of reference ids */ + referenceIds?: InputMaybe>; }; export enum ConfirmationType { From 3f190b577886fc4279a97def4381673272255ee9 Mon Sep 17 00:00:00 2001 From: Ian Krieger <48930920+IanKrieger@users.noreply.github.com> Date: Wed, 27 Sep 2023 10:44:27 -0400 Subject: [PATCH 2/2] fix: dont include creative set id (#906) * fix: dont include creative set id * fix: test --- src/form/fragmentUtil.ts | 1 - src/user/library/index.test.ts | 2 +- src/user/library/index.ts | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/form/fragmentUtil.ts b/src/form/fragmentUtil.ts index 2892fac8..e4833743 100644 --- a/src/form/fragmentUtil.ts +++ b/src/form/fragmentUtil.ts @@ -53,7 +53,6 @@ export function createAdSetFromFragment( campaignId, ads: ads.map((ad) => ({ creativeId: ad.creative.id, - creativeSetId: data.id, })), price: ads[0].price, bannedKeywords: data.bannedKeywords, diff --git a/src/user/library/index.test.ts b/src/user/library/index.test.ts index 762b3dd9..368c1874 100644 --- a/src/user/library/index.test.ts +++ b/src/user/library/index.test.ts @@ -157,7 +157,7 @@ describe("pricing logic (read)", () => { c.adSets = []; }); const formObject = editCampaignValues(campaign, "abc"); - expect(formObject.price).toEqual("100"); + expect(formObject.price).toEqual("6"); expect(formObject.billingType).toEqual("cpm"); }); }); diff --git a/src/user/library/index.ts b/src/user/library/index.ts index 63d2f8ba..3e128a7e 100644 --- a/src/user/library/index.ts +++ b/src/user/library/index.ts @@ -94,7 +94,7 @@ export function editCampaignValues( const billingType = (_.head(campaign.adSets)?.billingType ?? "cpm") as Billing; - const rawPrice = BigNumber(_.head(campaign.adSets)?.price ?? "0.1"); + const rawPrice = BigNumber(_.head(campaign.adSets)?.price ?? ".006"); const price = billingType === "cpm" ? rawPrice.multipliedBy(1000) : rawPrice; return {