4902 bug fix fix api filter for enum (#4909)

- Handle NUMERIC, SELECT, PROBABILITY, RATING FieldMetadataTypes

Those filters now works:
- http://localhost:3000/rest/opportunities?filter=stage[eq]:MEETING
-
http://localhost:3000/rest/opportunities?filter=stage[in]:[MEETING,NEW]

When providing wrong enum values, the following error messages are
returned:
- http://localhost:3000/rest/opportunities?filter=stage[eq]:MEETINGG
> BadRequestException: 'filter' enum value 'MEETINGG' not available in
'stage' enum. Available enum values are ['NEW', 'SCREENING', 'MEETING',
'PROPOSAL', 'CUSTOMER']
-
http://localhost:3000/rest/opportunities?filter=stage[in]:[MEETING,NEWW]
> BadRequestException: 'filter' enum value 'NEWW' not available in
'stage' enum. Available enum values are ['NEW', 'SCREENING', 'MEETING',
'PROPOSAL', 'CUSTOMER']
This commit is contained in:
martmull
2024-04-10 18:54:55 +02:00
committed by GitHub
parent cfcc93dee1
commit 01991fe717
7 changed files with 122 additions and 6 deletions

View File

@ -29,9 +29,38 @@ export const fieldCurrencyMock = {
defaultValue: { amountMicros: null, currencyCode: "''" },
};
export const fieldSelectMock = {
name: 'fieldSelect',
type: FieldMetadataType.SELECT,
isNullable: true,
defaultValue: 'OPTION_1',
options: [
{
id: '9a519a86-422b-4598-88ae-78751353f683',
color: 'red',
label: 'Opt 1',
value: 'OPTION_1',
position: 0,
},
{
id: '33f28d51-bc82-4e1d-ae4b-d9e4c0ed0ab4',
color: 'purple',
label: 'Opt 2',
value: 'OPTION_2',
position: 1,
},
],
};
export const objectMetadataItemMock = {
targetTableName: 'testingObject',
nameSingular: 'objectName',
namePlural: 'objectsName',
fields: [fieldNumberMock, fieldStringMock, fieldLinkMock, fieldCurrencyMock],
fields: [
fieldNumberMock,
fieldStringMock,
fieldLinkMock,
fieldCurrencyMock,
fieldSelectMock,
],
} as ObjectMetadataEntity;