Fix microAmount (#2654)
* Fix microAmount * Code review returns * Parse currency values as string * Jeremy's returns * fix: scalars not properly implemented * fix: filters not working on big float scalar --------- Co-authored-by: Jérémy Magrin <jeremy.magrin@gmail.com>
This commit is contained in:
@ -25,6 +25,7 @@ export enum FieldMetadataType {
|
||||
DATE_TIME = 'DATE_TIME',
|
||||
BOOLEAN = 'BOOLEAN',
|
||||
NUMBER = 'NUMBER',
|
||||
NUMERIC = 'NUMERIC',
|
||||
PROBABILITY = 'PROBABILITY',
|
||||
ENUM = 'ENUM',
|
||||
LINK = 'LINK',
|
||||
|
||||
@ -53,6 +53,7 @@ type FieldMetadataDefaultValueMapping = {
|
||||
[FieldMetadataType.DATE_TIME]: FieldMetadataDefaultValueDateTime;
|
||||
[FieldMetadataType.BOOLEAN]: FieldMetadataDefaultValueBoolean;
|
||||
[FieldMetadataType.NUMBER]: FieldMetadataDefaultValueNumber;
|
||||
[FieldMetadataType.NUMERIC]: FieldMetadataDefaultValueString;
|
||||
[FieldMetadataType.PROBABILITY]: FieldMetadataDefaultValueNumber;
|
||||
[FieldMetadataType.ENUM]: FieldMetadataDefaultValueString;
|
||||
[FieldMetadataType.LINK]: FieldMetadataDefaultValueLink;
|
||||
|
||||
@ -56,6 +56,19 @@ export function convertFieldMetadataToColumnActions(
|
||||
},
|
||||
];
|
||||
}
|
||||
case FieldMetadataType.NUMERIC: {
|
||||
const defaultValue =
|
||||
fieldMetadata.defaultValue as FieldMetadataDefaultValue<FieldMetadataType.NUMERIC>;
|
||||
|
||||
return [
|
||||
{
|
||||
action: WorkspaceMigrationColumnActionType.CREATE,
|
||||
columnName: fieldMetadata.targetColumnMap.value,
|
||||
columnType: 'numeric',
|
||||
defaultValue: serializeDefaultValue(defaultValue?.value),
|
||||
},
|
||||
];
|
||||
}
|
||||
case FieldMetadataType.NUMBER:
|
||||
case FieldMetadataType.PROBABILITY: {
|
||||
const defaultValue =
|
||||
@ -117,6 +130,7 @@ export function convertFieldMetadataToColumnActions(
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
case FieldMetadataType.CURRENCY: {
|
||||
const defaultValue =
|
||||
fieldMetadata.defaultValue as FieldMetadataDefaultValue<FieldMetadataType.CURRENCY>;
|
||||
@ -125,7 +139,7 @@ export function convertFieldMetadataToColumnActions(
|
||||
{
|
||||
action: WorkspaceMigrationColumnActionType.CREATE,
|
||||
columnName: fieldMetadata.targetColumnMap.amountMicros,
|
||||
columnType: 'integer',
|
||||
columnType: 'numeric',
|
||||
defaultValue: serializeDefaultValue(defaultValue?.amountMicros),
|
||||
},
|
||||
{
|
||||
|
||||
@ -24,6 +24,7 @@ export function generateTargetColumnMap(
|
||||
case FieldMetadataType.PHONE:
|
||||
case FieldMetadataType.EMAIL:
|
||||
case FieldMetadataType.NUMBER:
|
||||
case FieldMetadataType.NUMERIC:
|
||||
case FieldMetadataType.PROBABILITY:
|
||||
case FieldMetadataType.BOOLEAN:
|
||||
case FieldMetadataType.DATE_TIME:
|
||||
|
||||
@ -26,6 +26,7 @@ export const validateDefaultValueBasedOnType = (
|
||||
case FieldMetadataType.PHONE:
|
||||
case FieldMetadataType.EMAIL:
|
||||
case FieldMetadataType.ENUM:
|
||||
case FieldMetadataType.NUMERIC:
|
||||
return (
|
||||
typeof defaultValue === 'object' &&
|
||||
'value' in defaultValue &&
|
||||
|
||||
@ -55,7 +55,7 @@ export const addCompanyTable: WorkspaceMigrationTableAction[] = [
|
||||
},
|
||||
{
|
||||
columnName: 'annualRecurringRevenueAmountMicros',
|
||||
columnType: 'integer',
|
||||
columnType: 'numeric',
|
||||
action: WorkspaceMigrationColumnActionType.CREATE,
|
||||
},
|
||||
{
|
||||
|
||||
@ -14,7 +14,7 @@ export const addOpportunityTable: WorkspaceMigrationTableAction[] = [
|
||||
columns: [
|
||||
{
|
||||
columnName: 'amountAmountMicros',
|
||||
columnType: 'integer',
|
||||
columnType: 'numeric',
|
||||
action: WorkspaceMigrationColumnActionType.CREATE,
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user