Skip to content

Commit 3a3cb89

Browse files
Copilothotlong
andcommitted
Fix filter structures to use MongoDB-style operators and mapping mode
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 16bad1f commit 3a3cb89

File tree

2 files changed

+11
-21
lines changed

2 files changed

+11
-21
lines changed

examples/data/metadata-examples/src/mapping.examples.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ export const MigrationMapping: Mapping = {
452452
label: 'Migrate Products from Legacy System',
453453
sourceFormat: 'json',
454454
targetObject: 'product',
455-
mode: 'replace',
455+
mode: 'upsert',
456456

457457
fieldMapping: [
458458
{

examples/ui/metadata-examples/src/report.examples.ts

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ export const ActiveOpportunitiesReport: Report = {
5252
],
5353
filter: {
5454
$and: [
55-
{ field: 'stage', operator: 'ne', value: 'Closed Won' },
56-
{ field: 'stage', operator: 'ne', value: 'Closed Lost' },
55+
{ stage: { $ne: 'Closed Won' } },
56+
{ stage: { $ne: 'Closed Lost' } },
5757
],
5858
},
5959
};
@@ -102,9 +102,7 @@ export const SalesByRegionAndRepReport: Report = {
102102
{ field: 'owner_name', sortOrder: 'asc' },
103103
],
104104
filter: {
105-
field: 'stage',
106-
operator: 'eq',
107-
value: 'Closed Won',
105+
stage: { $eq: 'Closed Won' },
108106
},
109107
};
110108

@@ -127,9 +125,7 @@ export const MonthlyRevenueReport: Report = {
127125
{ field: 'close_date', sortOrder: 'desc', dateGranularity: 'month' },
128126
],
129127
filter: {
130-
field: 'stage',
131-
operator: 'eq',
132-
value: 'Closed Won',
128+
stage: { $eq: 'Closed Won' },
133129
},
134130
};
135131

@@ -158,9 +154,7 @@ export const SalesByProductAndQuarterReport: Report = {
158154
{ field: 'close_date', sortOrder: 'asc', dateGranularity: 'quarter' },
159155
],
160156
filter: {
161-
field: 'stage',
162-
operator: 'eq',
163-
value: 'Closed Won',
157+
stage: { $eq: 'Closed Won' },
164158
},
165159
};
166160

@@ -237,9 +231,7 @@ export const QuarterlyGrowthTrendReport: Report = {
237231
{ field: 'close_date', sortOrder: 'asc', dateGranularity: 'quarter' },
238232
],
239233
filter: {
240-
field: 'stage',
241-
operator: 'eq',
242-
value: 'Closed Won',
234+
stage: { $eq: 'Closed Won' },
243235
},
244236
chart: {
245237
type: 'line',
@@ -300,11 +292,11 @@ export const HighValueOpportunitiesReport: Report = {
300292
],
301293
filter: {
302294
$and: [
303-
{ field: 'amount', operator: 'gte', value: 100000 },
295+
{ amount: { $gte: 100000 } },
304296
{
305297
$or: [
306-
{ field: 'stage', operator: 'eq', value: 'Negotiation' },
307-
{ field: 'stage', operator: 'eq', value: 'Proposal' },
298+
{ stage: { $eq: 'Negotiation' } },
299+
{ stage: { $eq: 'Proposal' } },
308300
],
309301
},
310302
],
@@ -332,8 +324,6 @@ export const SalesPerformanceReport: Report = {
332324
{ field: 'owner_name', sortOrder: 'desc' },
333325
],
334326
filter: {
335-
field: 'stage',
336-
operator: 'eq',
337-
value: 'Closed Won',
327+
stage: { $eq: 'Closed Won' },
338328
},
339329
};

0 commit comments

Comments
 (0)