[BREAKING_CHANGE_VIEW_SORT] Refactor view sort to v2 (#17609)
Fixes https://github.com/twentyhq/core-team-issues/issues/2187 --------- Co-authored-by: prastoin <paul@twenty.com> Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
This commit is contained in:
+10
-1
@@ -1,4 +1,4 @@
|
||||
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`ALL_UNIVERSAL_FLAT_ENTITY_PROPERTIES_TO_COMPARE_AND_STRINGIFY should match snapshot 1`] = `
|
||||
{
|
||||
@@ -299,6 +299,15 @@ exports[`ALL_UNIVERSAL_FLAT_ENTITY_PROPERTIES_TO_COMPARE_AND_STRINGIFY should ma
|
||||
],
|
||||
"propertiesToStringify": [],
|
||||
},
|
||||
"viewSort": {
|
||||
"propertiesToCompare": [
|
||||
"direction",
|
||||
"fieldMetadataUniversalIdentifier",
|
||||
"viewUniversalIdentifier",
|
||||
"deletedAt",
|
||||
],
|
||||
"propertiesToStringify": [],
|
||||
},
|
||||
"webhook": {
|
||||
"propertiesToCompare": [
|
||||
"targetUrl",
|
||||
|
||||
+32
@@ -1162,6 +1162,38 @@ export const ALL_ENTITY_PROPERTIES_CONFIGURATION_BY_METADATA_NAME = {
|
||||
universalProperty: undefined,
|
||||
},
|
||||
},
|
||||
viewSort: {
|
||||
direction: {
|
||||
toCompare: true,
|
||||
toStringify: false,
|
||||
universalProperty: undefined,
|
||||
},
|
||||
fieldMetadataId: {
|
||||
toCompare: true,
|
||||
toStringify: false,
|
||||
universalProperty: 'fieldMetadataUniversalIdentifier',
|
||||
},
|
||||
createdAt: {
|
||||
toCompare: false,
|
||||
toStringify: false,
|
||||
universalProperty: undefined,
|
||||
},
|
||||
updatedAt: {
|
||||
toCompare: false,
|
||||
toStringify: false,
|
||||
universalProperty: undefined,
|
||||
},
|
||||
viewId: {
|
||||
toCompare: true,
|
||||
toStringify: false,
|
||||
universalProperty: 'viewUniversalIdentifier',
|
||||
},
|
||||
deletedAt: {
|
||||
toCompare: true,
|
||||
toStringify: false,
|
||||
universalProperty: undefined,
|
||||
},
|
||||
},
|
||||
viewFilterGroup: {
|
||||
viewId: {
|
||||
toCompare: true,
|
||||
|
||||
+10
@@ -240,6 +240,16 @@ export const ALL_MANY_TO_ONE_METADATA_FOREIGN_KEY = {
|
||||
workspace: null,
|
||||
application: null,
|
||||
},
|
||||
viewSort: {
|
||||
application: null,
|
||||
workspace: null,
|
||||
fieldMetadata: {
|
||||
foreignKey: 'fieldMetadataId',
|
||||
},
|
||||
view: {
|
||||
foreignKey: 'viewId',
|
||||
},
|
||||
},
|
||||
} as const satisfies ManyToOneMetadataRelationsProperties;
|
||||
|
||||
// satisfies with complex mapped types involving nested generics doesn't always catch missing required keys
|
||||
|
||||
+18
@@ -420,6 +420,24 @@ export const ALL_MANY_TO_ONE_METADATA_RELATIONS = {
|
||||
workspace: null,
|
||||
application: null,
|
||||
},
|
||||
viewSort: {
|
||||
application: null,
|
||||
workspace: null,
|
||||
fieldMetadata: {
|
||||
foreignKey: 'fieldMetadataId',
|
||||
universalForeignKey: 'fieldMetadataUniversalIdentifier',
|
||||
inverseOneToManyProperty: null,
|
||||
isNullable: false,
|
||||
metadataName: 'fieldMetadata',
|
||||
},
|
||||
view: {
|
||||
foreignKey: 'viewId',
|
||||
universalForeignKey: 'viewUniversalIdentifier',
|
||||
inverseOneToManyProperty: 'viewSorts',
|
||||
isNullable: false,
|
||||
metadataName: 'view',
|
||||
},
|
||||
},
|
||||
} as const satisfies ManyToOneMetadataRelationsProperties;
|
||||
|
||||
// satisfies with complex mapped types involving nested generics doesn't always catch missing required keys
|
||||
|
||||
+2
@@ -24,6 +24,7 @@ import { ViewFilterGroupEntity } from 'src/engine/metadata-modules/view-filter-g
|
||||
import { ViewFilterEntity } from 'src/engine/metadata-modules/view-filter/entities/view-filter.entity';
|
||||
import { ViewGroupEntity } from 'src/engine/metadata-modules/view-group/entities/view-group.entity';
|
||||
import { ViewEntity } from 'src/engine/metadata-modules/view/entities/view.entity';
|
||||
import { ViewSortEntity } from 'src/engine/metadata-modules/view-sort/entities/view-sort.entity';
|
||||
|
||||
export const ALL_METADATA_ENTITY_BY_METADATA_NAME = {
|
||||
viewField: ViewFieldEntity,
|
||||
@@ -49,4 +50,5 @@ export const ALL_METADATA_ENTITY_BY_METADATA_NAME = {
|
||||
commandMenuItem: CommandMenuItemEntity,
|
||||
navigationMenuItem: NavigationMenuItemEntity,
|
||||
webhook: WebhookEntity,
|
||||
viewSort: ViewSortEntity,
|
||||
} as const satisfies Record<AllMetadataName, EntityTarget<ObjectLiteral>>;
|
||||
|
||||
+4
@@ -53,6 +53,10 @@ export const ALL_METADATA_REQUIRED_METADATA_FOR_VALIDATION = {
|
||||
viewFilterGroup: {
|
||||
view: true,
|
||||
},
|
||||
viewSort: {
|
||||
fieldMetadata: true,
|
||||
view: true,
|
||||
},
|
||||
role: {},
|
||||
roleTarget: {
|
||||
role: true,
|
||||
|
||||
+1
@@ -44,6 +44,7 @@ export const ALL_METADATA_SERIALIZED_RELATION = {
|
||||
rowLevelPermissionPredicate: {},
|
||||
rowLevelPermissionPredicateGroup: {},
|
||||
viewFilterGroup: {},
|
||||
viewSort: {},
|
||||
frontComponent: {},
|
||||
webhook: {},
|
||||
} as const satisfies MetadataSerializedRelationProperties;
|
||||
|
||||
+6
@@ -37,6 +37,11 @@ export const ALL_ONE_TO_MANY_METADATA_RELATIONS = {
|
||||
commandMenuItem: {},
|
||||
navigationMenuItem: {},
|
||||
fieldMetadata: {
|
||||
viewSorts: {
|
||||
flatEntityForeignKeyAggregator: 'viewSortIds',
|
||||
metadataName: 'viewSort',
|
||||
universalFlatEntityForeignKeyAggregator: 'viewSortUniversalIdentifiers',
|
||||
},
|
||||
fieldPermissions: null,
|
||||
indexFieldMetadatas: null,
|
||||
viewFields: {
|
||||
@@ -202,6 +207,7 @@ export const ALL_ONE_TO_MANY_METADATA_RELATIONS = {
|
||||
},
|
||||
frontComponent: {},
|
||||
webhook: {},
|
||||
viewSort: {},
|
||||
} as const satisfies OneToManyMetadataRelationsProperties;
|
||||
|
||||
// satisfies with complex mapped types involving nested generics doesn't always catch missing required keys
|
||||
|
||||
Reference in New Issue
Block a user