[OBJECT_CACHE_FLUSH_REQUIRED_WHEN_RELEASED] Remove FlatObjectMetadata custom fieldMetadataIds fk aggregator property (#17438)
# Introduction Currently refactoring `flatEntity` typing, encountering some tsc errors due to this fk aggregator custom override It shall now follow generic pattern leading to be named `fieldIds` Needs to flush object cache when released
This commit is contained in:
+1
-1
@@ -107,7 +107,7 @@ describe('WorkspaceEntityManager', () => {
|
||||
isSystem: false,
|
||||
isActive: true,
|
||||
targetTableName: 'test_entity',
|
||||
fieldMetadataIds: ['field-id'],
|
||||
fieldIds: ['field-id'],
|
||||
indexMetadataIds: [],
|
||||
viewIds: [],
|
||||
universalIdentifier: 'test-entity-id',
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ export class EntitySchemaColumnFactory {
|
||||
): EntitySchemaColumnMap {
|
||||
let entitySchemaColumnMap: EntitySchemaColumnMap = {};
|
||||
|
||||
const fieldMetadataCollection = objectMetadata.fieldMetadataIds
|
||||
const fieldMetadataCollection = objectMetadata.fieldIds
|
||||
.map((fieldId) => fieldMetadataMaps.byId[fieldId])
|
||||
.filter(isDefined);
|
||||
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ export class EntitySchemaRelationFactory {
|
||||
): EntitySchemaRelationMap {
|
||||
const entitySchemaRelationMap: EntitySchemaRelationMap = {};
|
||||
|
||||
const fieldMetadatas = objectMetadata.fieldMetadataIds
|
||||
const fieldMetadatas = objectMetadata.fieldIds
|
||||
.map((fieldId) => fieldMetadataMaps.byId[fieldId])
|
||||
.filter(isDefined);
|
||||
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@ export type EntitySchemaObjectMetadata = Pick<
|
||||
ObjectMetadataEntity,
|
||||
'id' | 'nameSingular' | 'isCustom'
|
||||
> & {
|
||||
fieldMetadataIds: string[];
|
||||
fieldIds: string[];
|
||||
};
|
||||
|
||||
export type EntitySchemaFieldMetadata<
|
||||
@@ -60,7 +60,7 @@ export const buildEntitySchemaMetadataMaps = (
|
||||
id: object.id,
|
||||
nameSingular: object.nameSingular,
|
||||
isCustom: object.isCustom,
|
||||
fieldMetadataIds: fieldIdsByObjectId.get(object.id) ?? [],
|
||||
fieldIds: fieldIdsByObjectId.get(object.id) ?? [],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -167,7 +167,7 @@ describe('WorkspaceRepository', () => {
|
||||
id: 'test-metadata-id',
|
||||
nameSingular: 'test-entity',
|
||||
namePlural: 'test-entities',
|
||||
fieldMetadataIds: ['test-field-id'],
|
||||
fieldIds: ['test-field-id'],
|
||||
fieldIdByName: {
|
||||
id: 'test-field-id',
|
||||
},
|
||||
|
||||
+3
-3
@@ -206,7 +206,7 @@ describe('computeRelationConnectQueryConfigs', () => {
|
||||
partial: Partial<FlatObjectMetadata> & {
|
||||
id: string;
|
||||
nameSingular: string;
|
||||
fieldMetadataIds: string[];
|
||||
fieldIds: string[];
|
||||
indexMetadataIds: string[];
|
||||
},
|
||||
): FlatObjectMetadata =>
|
||||
@@ -244,7 +244,7 @@ describe('computeRelationConnectQueryConfigs', () => {
|
||||
id: 'person-object-metadata-id',
|
||||
nameSingular: 'person',
|
||||
indexMetadataIds: [],
|
||||
fieldMetadataIds: personFields.map((f) => f.id),
|
||||
fieldIds: personFields.map((f) => f.id),
|
||||
});
|
||||
|
||||
const companyMetadata = createFlatObjectMetadata({
|
||||
@@ -255,7 +255,7 @@ describe('computeRelationConnectQueryConfigs', () => {
|
||||
'company-domain-index-metadata-id',
|
||||
'company-composite-index-metadata-id',
|
||||
],
|
||||
fieldMetadataIds: companyFields.map((f) => f.id),
|
||||
fieldIds: companyFields.map((f) => f.id),
|
||||
});
|
||||
|
||||
const flatObjectMetadataMaps: FlatEntityMaps<FlatObjectMetadata> = {
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ describe('formatTwentyOrmEventToDatabaseBatchEvent', () => {
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
universalIdentifier: objectMetadataId,
|
||||
fieldMetadataIds: ['name-id'],
|
||||
fieldIds: ['name-id'],
|
||||
indexMetadataIds: [],
|
||||
viewIds: [],
|
||||
applicationId: null,
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@ import { getColumnNameToFieldMetadataIdMap } from 'src/engine/twenty-orm/utils/g
|
||||
|
||||
describe('getColumnNameToFieldMetadataIdMap', () => {
|
||||
const createMockFlatObjectMetadata = (
|
||||
fieldMetadataIds: string[],
|
||||
fieldIds: string[],
|
||||
): FlatObjectMetadata =>
|
||||
({
|
||||
id: 'test-object-id',
|
||||
@@ -26,7 +26,7 @@ describe('getColumnNameToFieldMetadataIdMap', () => {
|
||||
workspaceId: 'test-workspace-id',
|
||||
universalIdentifier: 'test-object-id',
|
||||
indexMetadataIds: [],
|
||||
fieldMetadataIds,
|
||||
fieldIds,
|
||||
viewIds: [],
|
||||
applicationId: 'test-application-id',
|
||||
isLabelSyncedWithName: false,
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@ import { getFieldMetadataIdToColumnNamesMap } from 'src/engine/twenty-orm/utils/
|
||||
|
||||
describe('getFieldMetadataIdToColumnNamesMap', () => {
|
||||
const createMockFlatObjectMetadata = (
|
||||
fieldMetadataIds: string[],
|
||||
fieldIds: string[],
|
||||
): FlatObjectMetadata =>
|
||||
({
|
||||
id: 'test-object-id',
|
||||
@@ -26,7 +26,7 @@ describe('getFieldMetadataIdToColumnNamesMap', () => {
|
||||
workspaceId: 'test-workspace-id',
|
||||
universalIdentifier: 'test-object-id',
|
||||
indexMetadataIds: [],
|
||||
fieldMetadataIds,
|
||||
fieldIds,
|
||||
viewIds: [],
|
||||
applicationId: 'test-application-id',
|
||||
isLabelSyncedWithName: false,
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@ import { isRecordMatchingRLSRowLevelPermissionPredicate } from 'src/engine/twent
|
||||
|
||||
describe('isRecordMatchingRLSRowLevelPermissionPredicate', () => {
|
||||
const createMockFlatObjectMetadata = (
|
||||
fieldMetadataIds: string[],
|
||||
fieldIds: string[],
|
||||
): FlatObjectMetadata =>
|
||||
({
|
||||
id: 'test-object-id',
|
||||
@@ -26,7 +26,7 @@ describe('isRecordMatchingRLSRowLevelPermissionPredicate', () => {
|
||||
workspaceId: 'test-workspace-id',
|
||||
universalIdentifier: 'test-object-id',
|
||||
indexMetadataIds: [],
|
||||
fieldMetadataIds,
|
||||
fieldIds,
|
||||
viewIds: [],
|
||||
applicationId: 'test-application-id',
|
||||
isLabelSyncedWithName: false,
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ export function processFieldMetadataForColumnNameMapping(
|
||||
flatFieldMetadataMaps: FlatEntityMaps<FlatFieldMetadata>,
|
||||
processor: ColumnNameProcessor,
|
||||
) {
|
||||
for (const fieldMetadataId of flatObjectMetadata.fieldMetadataIds) {
|
||||
for (const fieldMetadataId of flatObjectMetadata.fieldIds) {
|
||||
const fieldMetadata = findFlatEntityByIdInFlatEntityMapsOrThrow({
|
||||
flatEntityMaps: flatFieldMetadataMaps,
|
||||
flatEntityId: fieldMetadataId,
|
||||
|
||||
Reference in New Issue
Block a user