Repository: twentyhq/twenty
File: packages/twenty-server/src/engine/api/graphql/workspace-schema-builder/graphql-type-generators/input-types/group-by-input/group-by-date-granularity-gql-input-type.generator.ts (TypeScript)

Code before:
        name: 'DateGranularityEnum',
        values: Object.entries(ObjectRecordGroupByDateGranularity).reduce(
          (acc, [key, value]) => {
            acc[key] = { value };

            return acc;
          },
          {} as Record<string, { value: string }>,
        ),
        description:
          'Date granularity (e.g. day, month, quarter, year, week, day of the week, quarter of the year, month of the year)',
      }),
    );

    const dateGranularityEnum = this.gqlTypesStorage.getGqlTypeByKey(
      'DateGranularityEnum',
    ) as GraphQLEnumType;

    if (!isDefined(dateGranularityEnum)) {
      throw new Error('DateGranularityEnum not found');
    }

    // Create FirstDayOfTheWeek enum
    const firstDayOfWeekEnum = new GraphQLEnumType({
      name: 'FirstDayOfTheWeek',
      values: firstDayOfWeekSchema.options.reduce(
        (acc, option) => {
          acc[option] = { value: option };

          return acc;
        },
        {} as Record<string, { value: string }>,
      ),
      description: 'First day of the week (MONDAY, SUNDAY, SATURDAY)',
    });

    this.gqlTypesStorage.addGqlType('FirstDayOfTheWeek', firstDayOfWeekEnum);

    const groupByDateField = new GraphQLInputObjectType({
      name: GROUP_BY_DATE_GRANULARITY_INPUT_KEY,
      fields: {
        granularity: {
          type: dateGranularityEnum,
          description:
            'Date granularity (e.g. day, month, quarter, year, week, day of the week, quarter of the year, month of the year)',
        },
        weekStartDay: {
          type: firstDayOfWeekEnum,
          description:
            'First day of the week (only applicable when granularity is WEEK). Defaults to MONDAY if not specified.',
        },

Review comment (suggestion):
Nit: There is probably a type for this, right? I would use it instead to be consistent 

Code after:
    this.gqlTypesStorage.addGqlType(
      'DateGranularityEnum',
      new GraphQLEnumType({
        name: 'DateGranularityEnum',
        values: Object.entries(ObjectRecordGroupByDateGranularity).reduce(
          (acc, [key, value]) => {
            acc[key] = { value };

            return acc;
          },
          {} as Record<string, { value: string }>,
        ),
        description:
          'Date granularity (e.g. day, month, quarter, year, week, day of the week, quarter of the year, month of the year)',
      }),
    );

    const dateGranularityEnum = this.gqlTypesStorage.getGqlTypeByKey(
      'DateGranularityEnum',
    ) as GraphQLEnumType;

    if (!isDefined(dateGranularityEnum)) {
      throw new Error('DateGranularityEnum not found');
    }

    const firstDayOfWeekEnum = new GraphQLEnumType({
      name: 'FirstDayOfTheWeek',
      values: Object.values(FirstDayOfTheWeek).reduce(
        (acc, option) => {
          acc[option] = { value: option };

          return acc;
        },
        {} as Record<string, { value: string }>,
      ),
      description: 'First day of the week (MONDAY, SUNDAY, SATURDAY)',
    });

    this.gqlTypesStorage.addGqlType('FirstDayOfTheWeek', firstDayOfWeekEnum);

    const groupByDateField = new GraphQLInputObjectType({
      name: GROUP_BY_DATE_GRANULARITY_INPUT_KEY,
      fields: {
        granularity: {
          type: dateGranularityEnum,
          description:
            'Date granularity (e.g. day, month, quarter, year, week, day of the week, quarter of the year, month of the year)',
        },
        weekStartDay: {
          type: firstDayOfWeekEnum,
          description: