[DASHBOARDS] Move all the graph computing logic to the backend (#17189)

- Create resolvers for each type of charts which needs data
transformation after the group by operation: Bar Chart, Line Chart and
Pie Chart
- Move all the utils to the backend and refactored some into services

This allows all the computation to be done in the backend, improving
performances in the frontend.
This commit is contained in:
Raphaël Bosi
2026-01-19 18:25:45 +01:00
committed by GitHub
parent 1f1ccb281e
commit d0bc8b9ffe
264 changed files with 12408 additions and 8872 deletions
@@ -0,0 +1 @@
export const BAR_CHART_MAXIMUM_NUMBER_OF_BARS = 100;
@@ -0,0 +1 @@
export const BAR_CHART_MAXIMUM_NUMBER_OF_GROUPS_PER_BAR = 50;
@@ -0,0 +1,8 @@
import { ObjectRecordGroupByDateGranularity } from 'twenty-shared/types';
export const DATE_GRANULARITIES_WITHOUT_GAP_FILLING = new Set([
ObjectRecordGroupByDateGranularity.DAY_OF_THE_WEEK,
ObjectRecordGroupByDateGranularity.MONTH_OF_THE_YEAR,
ObjectRecordGroupByDateGranularity.QUARTER_OF_THE_YEAR,
ObjectRecordGroupByDateGranularity.NONE,
]);
@@ -0,0 +1 @@
export const EXTRA_ITEM_TO_DETECT_TOO_MANY_GROUPS = 1;
@@ -0,0 +1,4 @@
import { ObjectRecordGroupByDateGranularity } from 'twenty-shared/types';
export const GRAPH_DEFAULT_DATE_GRANULARITY =
ObjectRecordGroupByDateGranularity.DAY;
@@ -0,0 +1,3 @@
import { GraphOrderBy } from 'src/engine/metadata-modules/page-layout-widget/enums/graph-order-by.enum';
export const GRAPH_DEFAULT_ORDER_BY = GraphOrderBy.FIELD_ASC;
@@ -0,0 +1 @@
export const LINE_CHART_MAXIMUM_NUMBER_OF_DATA_POINTS = 100;
@@ -0,0 +1 @@
export const LINE_CHART_MAXIMUM_NUMBER_OF_NON_STACKED_SERIES = 50;
@@ -0,0 +1 @@
export const LINE_CHART_MAXIMUM_NUMBER_OF_STACKED_SERIES = 50;
@@ -0,0 +1 @@
export const PIE_CHART_MAXIMUM_NUMBER_OF_SLICES = 100;
@@ -0,0 +1,8 @@
import { type ObjectRecordGroupByDateGranularity } from 'twenty-shared/types';
export type SupportedDateGranularityForGapFilling =
| ObjectRecordGroupByDateGranularity.DAY
| ObjectRecordGroupByDateGranularity.MONTH
| ObjectRecordGroupByDateGranularity.QUARTER
| ObjectRecordGroupByDateGranularity.YEAR
| ObjectRecordGroupByDateGranularity.WEEK;