From 7bac5ac4b7a8b0d9b6205d9c4adce235ba54b6bf Mon Sep 17 00:00:00 2001 From: Chinedu Olebu Date: Thu, 26 Sep 2024 11:32:45 -0700 Subject: [PATCH] feat(3636): track reasons for choosing cloud provider --- .../billing/PublicCloudBillingInfo.tsx | 15 ++++++--------- app/components/billing/types.ts | 2 +- ...c_cloud_provider_selection_reason_field1.js | 18 ++++++++++++++++++ 3 files changed, 25 insertions(+), 10 deletions(-) create mode 100644 data-migrations/migrations/20240927022019-populate_missing_public_cloud_provider_selection_reason_field1.js diff --git a/app/components/billing/PublicCloudBillingInfo.tsx b/app/components/billing/PublicCloudBillingInfo.tsx index 5575fb326..048a89617 100644 --- a/app/components/billing/PublicCloudBillingInfo.tsx +++ b/app/components/billing/PublicCloudBillingInfo.tsx @@ -15,15 +15,12 @@ export default function PublicCloudBillingInfo({ product, className, }: { - product: Omit< - Product & { - _permissions?: { - signMou: boolean; - reviewMou: boolean; - }; - }, - 'providerSelectionReasons' | 'providerSelectionReasonsNote' - >; + product: Product & { + _permissions?: { + signMou: boolean; + reviewMou: boolean; + }; + }; className?: string; }) { const { data: session } = useSession(); diff --git a/app/components/billing/types.ts b/app/components/billing/types.ts index 8051a5f26..e49155f70 100644 --- a/app/components/billing/types.ts +++ b/app/components/billing/types.ts @@ -12,5 +12,5 @@ export type Product = Omit< }; }; }>, - 'updatedAt' | 'providerSelectionReasons' | 'providerSelectionReasonsNote' + 'updatedAt' >; diff --git a/data-migrations/migrations/20240927022019-populate_missing_public_cloud_provider_selection_reason_field1.js b/data-migrations/migrations/20240927022019-populate_missing_public_cloud_provider_selection_reason_field1.js new file mode 100644 index 000000000..c24fbe386 --- /dev/null +++ b/data-migrations/migrations/20240927022019-populate_missing_public_cloud_provider_selection_reason_field1.js @@ -0,0 +1,18 @@ +export const up = async (db, client) => { + await Promise.all([ + db + .collection('PublicCloudRequestedProject') + .updateMany( + { $or: [{ providerSelectionReasonsNote: null }, { providerSelectionReasonsNote: { $exists: false } }] }, + { $set: { providerSelectionReasonsNote: '' } }, + ), + db + .collection('PublicCloudProject') + .updateMany( + { $or: [{ providerSelectionReasonsNote: null }, { providerSelectionReasonsNote: { $exists: false } }] }, + { $set: { providerSelectionReasonsNote: '' } }, + ), + ]); +}; + +export const down = async (db, client) => {};