feat: raise FILES field max number of values from 10 to 60 (#20950)

## Summary

Raises the artificial hardcoded ceiling on `maxNumberOfValues` for
custom FILES fields from `10` to `60` so users can attach more files per
record.

- Bumped `FILES_FIELD_MAX_NUMBER_OF_VALUES` constant in `twenty-shared`
from `10` to `60`
- Updated validator unit test (inline snapshots + "exceeds max" case)
- Updated create/update files-field metadata integration tests and Jest
snapshots

The frontend Zod schema only enforces a `min`, so no frontend changes
are required — the backend constant is the single source of truth for
the upper bound.

Refs #20942

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
This commit is contained in:
Félix Malfait
2026-05-27 10:53:09 +02:00
committed by GitHub
parent 423faa6153
commit ac89d2ff56
6 changed files with 32 additions and 32 deletions
@@ -57,7 +57,7 @@ describe('validateFilesFlatFieldMetadata', () => {
[
{
"code": "INVALID_FIELD_INPUT",
"message": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 10",
"message": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 60",
},
]
`);
@@ -74,16 +74,16 @@ describe('validateFilesFlatFieldMetadata', () => {
[
{
"code": "INVALID_FIELD_INPUT",
"message": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 10",
"message": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 60",
},
]
`);
});
it('should return error when maxNumberOfValues exceeds max (11)', () => {
it('should return error when maxNumberOfValues exceeds max (61)', () => {
const errors = callValidator(
createFlatEntityToValidate({
universalSettings: { maxNumberOfValues: 11 },
universalSettings: { maxNumberOfValues: 61 },
}),
);
@@ -91,7 +91,7 @@ describe('validateFilesFlatFieldMetadata', () => {
[
{
"code": "INVALID_FIELD_INPUT",
"message": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 10",
"message": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 60",
},
]
`);
@@ -66,8 +66,8 @@ exports[`createOne FILES field metadata - failing should fail to create files fi
"errors": [
{
"code": "INVALID_FIELD_INPUT",
"message": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 10",
"userFriendlyMessage": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 10",
"message": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 60",
"userFriendlyMessage": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 60",
},
],
"flatEntityMinimalInformation": {
@@ -86,14 +86,14 @@ exports[`createOne FILES field metadata - failing should fail to create files fi
"fieldMetadata": 1,
"totalErrors": 1,
},
"userFriendlyMessage": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 10",
"userFriendlyMessage": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 60",
},
"message": "Multiple validation errors occurred while creating fields",
"name": "GraphQLError",
}
`;
exports[`createOne FILES field metadata - failing should fail to create files field with maxNumberOfValues = 11 (exceeds max) 1`] = `
exports[`createOne FILES field metadata - failing should fail to create files field with maxNumberOfValues = 61 (exceeds max) 1`] = `
{
"extensions": {
"code": "METADATA_VALIDATION_FAILED",
@@ -103,8 +103,8 @@ exports[`createOne FILES field metadata - failing should fail to create files fi
"errors": [
{
"code": "INVALID_FIELD_INPUT",
"message": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 10",
"userFriendlyMessage": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 10",
"message": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 60",
"userFriendlyMessage": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 60",
},
],
"flatEntityMinimalInformation": {
@@ -123,7 +123,7 @@ exports[`createOne FILES field metadata - failing should fail to create files fi
"fieldMetadata": 1,
"totalErrors": 1,
},
"userFriendlyMessage": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 10",
"userFriendlyMessage": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 60",
},
"message": "Multiple validation errors occurred while creating fields",
"name": "GraphQLError",
@@ -140,8 +140,8 @@ exports[`createOne FILES field metadata - failing should fail to create files fi
"errors": [
{
"code": "INVALID_FIELD_INPUT",
"message": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 10",
"userFriendlyMessage": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 10",
"message": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 60",
"userFriendlyMessage": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 60",
},
],
"flatEntityMinimalInformation": {
@@ -160,7 +160,7 @@ exports[`createOne FILES field metadata - failing should fail to create files fi
"fieldMetadata": 1,
"totalErrors": 1,
},
"userFriendlyMessage": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 10",
"userFriendlyMessage": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 60",
},
"message": "Multiple validation errors occurred while creating fields",
"name": "GraphQLError",
@@ -10,8 +10,8 @@ exports[`updateOne FILES field metadata - failing should fail to update files fi
"errors": [
{
"code": "INVALID_FIELD_INPUT",
"message": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 10",
"userFriendlyMessage": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 10",
"message": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 60",
"userFriendlyMessage": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 60",
},
],
"flatEntityMinimalInformation": {
@@ -30,14 +30,14 @@ exports[`updateOne FILES field metadata - failing should fail to update files fi
"fieldMetadata": 1,
"totalErrors": 1,
},
"userFriendlyMessage": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 10",
"userFriendlyMessage": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 60",
},
"message": "Multiple validation errors occurred while updating field",
"name": "GraphQLError",
}
`;
exports[`updateOne FILES field metadata - failing should fail to update files field settings with maxNumberOfValues = 11 (exceeds max) 1`] = `
exports[`updateOne FILES field metadata - failing should fail to update files field settings with maxNumberOfValues = 61 (exceeds max) 1`] = `
{
"extensions": {
"code": "METADATA_VALIDATION_FAILED",
@@ -47,8 +47,8 @@ exports[`updateOne FILES field metadata - failing should fail to update files fi
"errors": [
{
"code": "INVALID_FIELD_INPUT",
"message": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 10",
"userFriendlyMessage": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 10",
"message": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 60",
"userFriendlyMessage": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 60",
},
],
"flatEntityMinimalInformation": {
@@ -67,7 +67,7 @@ exports[`updateOne FILES field metadata - failing should fail to update files fi
"fieldMetadata": 1,
"totalErrors": 1,
},
"userFriendlyMessage": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 10",
"userFriendlyMessage": "maxNumberOfValues must be defined in settings and be a number greater than 0 and less than or equal to 60",
},
"message": "Multiple validation errors occurred while updating field",
"name": "GraphQLError",
@@ -90,15 +90,15 @@ describe('createOne FILES field metadata - successful', () => {
expect(data.createOneField.settings).toEqual({ maxNumberOfValues: 5 });
});
it('should create files field with maxNumberOfValues = 10 (max allowed)', async () => {
it('should create files field with maxNumberOfValues = 60 (max allowed)', async () => {
const { data, errors } = await createOneFieldMetadata({
expectToFail: false,
input: {
objectMetadataId: createdObjectMetadataId,
name: 'filesFieldTen',
label: 'Files Field Ten',
name: 'filesFieldSixty',
label: 'Files Field Sixty',
type: FieldMetadataType.FILES,
settings: { maxNumberOfValues: 10 },
settings: { maxNumberOfValues: 60 },
},
gqlFields: `
id
@@ -113,7 +113,7 @@ describe('createOne FILES field metadata - successful', () => {
expect(data).not.toBeNull();
expect(data.createOneField).toBeDefined();
expect(data.createOneField.type).toBe(FieldMetadataType.FILES);
expect(data.createOneField.settings).toEqual({ maxNumberOfValues: 10 });
expect(data.createOneField.settings).toEqual({ maxNumberOfValues: 60 });
});
});
@@ -165,7 +165,7 @@ describe('createOne FILES field metadata - failing', () => {
expectOneNotInternalServerErrorSnapshot({ errors });
});
it('should fail to create files field with maxNumberOfValues = 11 (exceeds max)', async () => {
it('should fail to create files field with maxNumberOfValues = 61 (exceeds max)', async () => {
const { errors } = await createOneFieldMetadata({
expectToFail: true,
input: {
@@ -173,7 +173,7 @@ describe('createOne FILES field metadata - failing', () => {
name: 'filesFieldExceeds',
label: 'Files Field Exceeds',
type: FieldMetadataType.FILES,
settings: { maxNumberOfValues: 11 },
settings: { maxNumberOfValues: 61 },
},
});
@@ -214,13 +214,13 @@ describe('updateOne FILES field metadata - failing', () => {
expectOneNotInternalServerErrorSnapshot({ errors });
});
it('should fail to update files field settings with maxNumberOfValues = 11 (exceeds max)', async () => {
it('should fail to update files field settings with maxNumberOfValues = 61 (exceeds max)', async () => {
const { errors } = await updateOneFieldMetadata({
expectToFail: true,
input: {
idToUpdate: createdFieldMetadataId,
updatePayload: {
settings: { maxNumberOfValues: 11 },
settings: { maxNumberOfValues: 61 },
},
},
});
@@ -1 +1 @@
export const FILES_FIELD_MAX_NUMBER_OF_VALUES = 10;
export const FILES_FIELD_MAX_NUMBER_OF_VALUES = 60;