Commit c7c8564
authored
fix(insights): convert string filter values to numbers for integer columns (calcom#24730)
## What does this PR do?
Fixes PostgreSQL error "operator does not exist: integer = text" when filtering
by `bookingStatusOrder` and `bookingUserId` fields. Frontend sends filter values as
strings, but these database columns are integers requiring type conversion.
Changes:
- Convert `bookingStatusOrder` filter values from strings to numbers
- Convert `bookingUserId` filter values from strings to numbers
- Update tests to use numeric values for `bookingStatusOrder` filters
- Add test for string-to-number conversion in `bookingUserId` filter
- Fix `Prisma.Sql` composition in 3 integration tests
## Mandatory Tasks (DO NOT REMOVE)
- [x] I have self-reviewed the code (A decent size PR without self-review might be rejected).
- [x] N/A - I have updated the developer docs in /docs if this PR makes changes that would require a [documentation change](https://cal.com/docs). If N/A, write N/A here and check the checkbox.
- [x] I confirm automated tests are in place that prove my fix is effective or that my feature works.
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Converts string filter values to numbers for integer columns in Insights routing to prevent PostgreSQL type errors. Fixes filtering by bookingStatusOrder and bookingUserId when the frontend sends strings.
- **Bug Fixes**
- Cast bookingStatusOrder and bookingUserId filter values to numbers and use = ANY([...]).
- Update tests to expect numeric arrays; add test for string-to-number conversion on bookingUserId.
- Correct Prisma.sql composition in three integration tests before calling $queryRaw.
<!-- End of auto-generated description by cubic. -->1 parent b620581 commit c7c8564
2 files changed
Lines changed: 68 additions & 16 deletions
File tree
- packages/features/insights/services
Lines changed: 15 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
710 | 710 | | |
711 | 711 | | |
712 | 712 | | |
713 | | - | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
714 | 719 | | |
715 | 720 | | |
716 | 721 | | |
| |||
764 | 769 | | |
765 | 770 | | |
766 | 771 | | |
767 | | - | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
768 | 781 | | |
769 | 782 | | |
770 | 783 | | |
| |||
Lines changed: 53 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
759 | 759 | | |
760 | 760 | | |
761 | 761 | | |
762 | | - | |
| 762 | + | |
763 | 763 | | |
764 | 764 | | |
| 765 | + | |
765 | 766 | | |
766 | 767 | | |
767 | 768 | | |
| |||
863 | 864 | | |
864 | 865 | | |
865 | 866 | | |
866 | | - | |
| 867 | + | |
867 | 868 | | |
868 | 869 | | |
| 870 | + | |
869 | 871 | | |
870 | 872 | | |
871 | 873 | | |
| |||
953 | 955 | | |
954 | 956 | | |
955 | 957 | | |
956 | | - | |
| 958 | + | |
957 | 959 | | |
958 | 960 | | |
| 961 | + | |
959 | 962 | | |
960 | 963 | | |
961 | 964 | | |
| |||
1070 | 1073 | | |
1071 | 1074 | | |
1072 | 1075 | | |
1073 | | - | |
| 1076 | + | |
1074 | 1077 | | |
1075 | 1078 | | |
1076 | 1079 | | |
| |||
1081 | 1084 | | |
1082 | 1085 | | |
1083 | 1086 | | |
1084 | | - | |
| 1087 | + | |
1085 | 1088 | | |
1086 | 1089 | | |
1087 | 1090 | | |
| |||
1204 | 1207 | | |
1205 | 1208 | | |
1206 | 1209 | | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
1207 | 1249 | | |
1208 | 1250 | | |
1209 | 1251 | | |
| |||
1450 | 1492 | | |
1451 | 1493 | | |
1452 | 1494 | | |
1453 | | - | |
| 1495 | + | |
1454 | 1496 | | |
1455 | 1497 | | |
1456 | 1498 | | |
| |||
1476 | 1518 | | |
1477 | 1519 | | |
1478 | 1520 | | |
1479 | | - | |
| 1521 | + | |
1480 | 1522 | | |
1481 | 1523 | | |
1482 | 1524 | | |
| |||
1556 | 1598 | | |
1557 | 1599 | | |
1558 | 1600 | | |
1559 | | - | |
| 1601 | + | |
1560 | 1602 | | |
1561 | 1603 | | |
1562 | 1604 | | |
| |||
1567 | 1609 | | |
1568 | 1610 | | |
1569 | 1611 | | |
1570 | | - | |
1571 | | - | |
1572 | | - | |
1573 | | - | |
| 1612 | + | |
1574 | 1613 | | |
1575 | 1614 | | |
1576 | 1615 | | |
| |||
1600 | 1639 | | |
1601 | 1640 | | |
1602 | 1641 | | |
1603 | | - | |
| 1642 | + | |
1604 | 1643 | | |
1605 | 1644 | | |
1606 | 1645 | | |
| |||
1618 | 1657 | | |
1619 | 1658 | | |
1620 | 1659 | | |
1621 | | - | |
| 1660 | + | |
1622 | 1661 | | |
1623 | 1662 | | |
1624 | 1663 | | |
| |||
0 commit comments