Refactor read only object and fields (#13936)
Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
+5
@@ -108,6 +108,11 @@ export class FieldMetadataDTO<T extends FieldMetadataType = FieldMetadataType> {
|
||||
@FilterableField({ nullable: true })
|
||||
isSystem?: boolean;
|
||||
|
||||
@IsBoolean()
|
||||
@IsOptional()
|
||||
@FilterableField({ nullable: true })
|
||||
isUIReadOnly?: boolean;
|
||||
|
||||
@IsBoolean()
|
||||
@IsOptional()
|
||||
@Field({ nullable: true })
|
||||
|
||||
+3
@@ -103,6 +103,9 @@ export class FieldMetadataEntity<
|
||||
@Column({ default: false })
|
||||
isSystem: boolean;
|
||||
|
||||
@Column({ default: false })
|
||||
isUIReadOnly: boolean;
|
||||
|
||||
// Is this really nullable ?
|
||||
@Column({ nullable: true, default: true, type: 'boolean' })
|
||||
isNullable: boolean | null;
|
||||
|
||||
+1
@@ -30,6 +30,7 @@ export const getFlatFieldMetadataMock = <T extends FieldMetadataType>(
|
||||
label: 'flat field metadata label',
|
||||
isNullable: true,
|
||||
isUnique: false,
|
||||
isUIReadOnly: false,
|
||||
isLabelSyncedWithName: false,
|
||||
isSystem: false,
|
||||
standardId: null,
|
||||
|
||||
+1
@@ -53,5 +53,6 @@ export const getDefaultFlatFieldMetadata = ({
|
||||
settings: settings ?? null,
|
||||
createdAt,
|
||||
updatedAt: createdAt,
|
||||
isUIReadOnly: createFieldInput.isUIReadOnly ?? false,
|
||||
} as const satisfies FlatFieldMetadata;
|
||||
};
|
||||
|
||||
+1
@@ -25,6 +25,7 @@ export const getFlatObjectMetadataMock = (
|
||||
isRemote: false,
|
||||
isSearchable: true,
|
||||
isSystem: false,
|
||||
isUIReadOnly: false,
|
||||
labelIdentifierFieldMetadataId: faker.string.uuid(),
|
||||
labelPlural: 'default flat object metadata label plural',
|
||||
labelSingular: 'default flat object metadata label singular',
|
||||
|
||||
+1
@@ -63,6 +63,7 @@ export const fromCreateObjectInputToFlatObjectMetadataAndFlatFieldMetadatasToCre
|
||||
isLabelSyncedWithName: createObjectInput.isLabelSyncedWithName ?? false,
|
||||
isRemote: createObjectInput.isRemote ?? false,
|
||||
isSearchable: true,
|
||||
isUIReadOnly: false,
|
||||
isSystem: false,
|
||||
labelIdentifierFieldMetadataId: baseCustomFlatFieldMetadatas.nameField.id,
|
||||
labelPlural: capitalize(createObjectInput.labelPlural),
|
||||
|
||||
+3
@@ -71,6 +71,9 @@ export class ObjectMetadataDTO {
|
||||
@FilterableField()
|
||||
isSystem: boolean;
|
||||
|
||||
@FilterableField()
|
||||
isUIReadOnly: boolean;
|
||||
|
||||
@FilterableField()
|
||||
isSearchable: boolean;
|
||||
|
||||
|
||||
+3
@@ -76,6 +76,9 @@ export class ObjectMetadataEntity implements Required<ObjectMetadataEntity> {
|
||||
@Column({ default: false })
|
||||
isSystem: boolean;
|
||||
|
||||
@Column({ default: false })
|
||||
isUIReadOnly: boolean;
|
||||
|
||||
@Column({ default: true })
|
||||
isAuditLogged: boolean;
|
||||
|
||||
|
||||
+7
@@ -22,6 +22,7 @@ export const buildDefaultFieldsForCustomObject = (
|
||||
isActive: true,
|
||||
isCustom: false,
|
||||
isSystem: true,
|
||||
isUIReadOnly: true,
|
||||
workspaceId,
|
||||
defaultValue: 'uuid',
|
||||
},
|
||||
@@ -36,6 +37,7 @@ export const buildDefaultFieldsForCustomObject = (
|
||||
isNullable: false,
|
||||
isActive: true,
|
||||
isCustom: false,
|
||||
isUIReadOnly: false,
|
||||
workspaceId,
|
||||
defaultValue: "'Untitled'",
|
||||
},
|
||||
@@ -50,6 +52,7 @@ export const buildDefaultFieldsForCustomObject = (
|
||||
isNullable: false,
|
||||
isActive: true,
|
||||
isCustom: false,
|
||||
isUIReadOnly: false,
|
||||
workspaceId,
|
||||
defaultValue: 'now',
|
||||
},
|
||||
@@ -65,6 +68,7 @@ export const buildDefaultFieldsForCustomObject = (
|
||||
isActive: true,
|
||||
isCustom: false,
|
||||
isSystem: false,
|
||||
isUIReadOnly: false,
|
||||
workspaceId,
|
||||
defaultValue: 'now',
|
||||
},
|
||||
@@ -80,6 +84,7 @@ export const buildDefaultFieldsForCustomObject = (
|
||||
isActive: true,
|
||||
isCustom: false,
|
||||
isSystem: false,
|
||||
isUIReadOnly: true,
|
||||
workspaceId,
|
||||
defaultValue: null,
|
||||
},
|
||||
@@ -95,6 +100,7 @@ export const buildDefaultFieldsForCustomObject = (
|
||||
isActive: true,
|
||||
isCustom: false,
|
||||
isSystem: false,
|
||||
isUIReadOnly: true,
|
||||
workspaceId,
|
||||
defaultValue: { name: "''", source: "'MANUAL'" },
|
||||
},
|
||||
@@ -110,6 +116,7 @@ export const buildDefaultFieldsForCustomObject = (
|
||||
isActive: true,
|
||||
isCustom: false,
|
||||
isSystem: true,
|
||||
isUIReadOnly: false,
|
||||
workspaceId,
|
||||
defaultValue: 0,
|
||||
},
|
||||
|
||||
+8
@@ -35,6 +35,7 @@ export const buildDefaultFlatFieldMetadatasForCustomObject = ({
|
||||
isActive: true,
|
||||
isCustom: false,
|
||||
isSystem: true,
|
||||
isUIReadOnly: true,
|
||||
defaultValue: 'uuid',
|
||||
|
||||
createdAt,
|
||||
@@ -65,6 +66,7 @@ export const buildDefaultFlatFieldMetadatasForCustomObject = ({
|
||||
isActive: true,
|
||||
isCustom: false,
|
||||
isSystem: false,
|
||||
isUIReadOnly: false,
|
||||
defaultValue: "'Untitled'",
|
||||
|
||||
createdAt,
|
||||
@@ -95,6 +97,7 @@ export const buildDefaultFlatFieldMetadatasForCustomObject = ({
|
||||
isActive: true,
|
||||
isCustom: false,
|
||||
isSystem: false,
|
||||
isUIReadOnly: true,
|
||||
defaultValue: 'now',
|
||||
|
||||
createdAt,
|
||||
@@ -125,6 +128,7 @@ export const buildDefaultFlatFieldMetadatasForCustomObject = ({
|
||||
isActive: true,
|
||||
isCustom: false,
|
||||
isSystem: false,
|
||||
isUIReadOnly: true,
|
||||
defaultValue: 'now',
|
||||
|
||||
createdAt,
|
||||
@@ -155,6 +159,7 @@ export const buildDefaultFlatFieldMetadatasForCustomObject = ({
|
||||
isActive: true,
|
||||
isCustom: false,
|
||||
isSystem: false,
|
||||
isUIReadOnly: true,
|
||||
defaultValue: null,
|
||||
|
||||
createdAt,
|
||||
@@ -185,6 +190,7 @@ export const buildDefaultFlatFieldMetadatasForCustomObject = ({
|
||||
isActive: true,
|
||||
isCustom: false,
|
||||
isSystem: false,
|
||||
isUIReadOnly: true,
|
||||
defaultValue: { name: "''", source: "'MANUAL'" },
|
||||
|
||||
createdAt,
|
||||
@@ -215,6 +221,7 @@ export const buildDefaultFlatFieldMetadatasForCustomObject = ({
|
||||
isActive: true,
|
||||
isCustom: false,
|
||||
isSystem: true,
|
||||
isUIReadOnly: true,
|
||||
defaultValue: 0,
|
||||
|
||||
createdAt,
|
||||
@@ -245,6 +252,7 @@ export const buildDefaultFlatFieldMetadatasForCustomObject = ({
|
||||
isActive: true,
|
||||
isCustom: false,
|
||||
isSystem: true,
|
||||
isUIReadOnly: true,
|
||||
defaultValue: null,
|
||||
|
||||
createdAt,
|
||||
|
||||
+2
@@ -75,6 +75,7 @@ const generateSourceFlatFieldMetadata = ({
|
||||
isCustom: false,
|
||||
isLabelSyncedWithName: false,
|
||||
isNullable: true,
|
||||
isUIReadOnly: false,
|
||||
isSystem: true,
|
||||
isUnique: false,
|
||||
label: capitalize(targetFlatObjectMetadata.namePlural),
|
||||
@@ -133,6 +134,7 @@ const generateTargetFlatFieldMetadata = ({
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: true,
|
||||
isUIReadOnly: false,
|
||||
type: FieldMetadataType.RELATION,
|
||||
icon: 'IconBuildingSkyscraper',
|
||||
isNullable: true,
|
||||
|
||||
Reference in New Issue
Block a user