add new @WorkspaceIsSearchable decorator + updates services + add migration command (#10507)
closes https://github.com/twentyhq/core-team-issues/issues/345
This commit is contained in:
@ -18,6 +18,7 @@ export const mockObjectMetadataItemsWithFieldMaps: ObjectMetadataItemWithFieldMa
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isAuditLogged: true,
|
||||
isSearchable: true,
|
||||
fromRelations: [],
|
||||
toRelations: [],
|
||||
labelIdentifierFieldMetadataId: 'nameFieldMetadataId',
|
||||
@ -76,6 +77,7 @@ export const mockObjectMetadataItemsWithFieldMaps: ObjectMetadataItemWithFieldMa
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isAuditLogged: true,
|
||||
isSearchable: true,
|
||||
fromRelations: [],
|
||||
toRelations: [],
|
||||
labelIdentifierFieldMetadataId: 'nameFieldMetadataId',
|
||||
@ -153,6 +155,7 @@ export const mockObjectMetadataItemsWithFieldMaps: ObjectMetadataItemWithFieldMa
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isAuditLogged: true,
|
||||
isSearchable: true,
|
||||
fromRelations: [],
|
||||
toRelations: [],
|
||||
labelIdentifierFieldMetadataId: 'nameFieldMetadataId',
|
||||
@ -230,6 +233,7 @@ export const mockObjectMetadataItemsWithFieldMaps: ObjectMetadataItemWithFieldMa
|
||||
isActive: true,
|
||||
isSystem: true,
|
||||
isAuditLogged: true,
|
||||
isSearchable: false,
|
||||
fromRelations: [],
|
||||
toRelations: [],
|
||||
labelIdentifierFieldMetadataId: '',
|
||||
|
||||
@ -19,7 +19,7 @@ describe('GlobalSearchService', () => {
|
||||
});
|
||||
|
||||
describe('filterObjectMetadataItems', () => {
|
||||
it('should return searchable object metadata items -- TODO isSearchable only', () => {
|
||||
it('should return searchable object metadata items', () => {
|
||||
const objectMetadataItems = service.filterObjectMetadataItems(
|
||||
mockObjectMetadataItemsWithFieldMaps,
|
||||
[],
|
||||
|
||||
@ -22,20 +22,9 @@ export class GlobalSearchService {
|
||||
excludedObjectNameSingulars: string[] | undefined,
|
||||
) {
|
||||
return objectMetadataItemWithFieldMaps.filter(
|
||||
({ nameSingular, isSystem, isRemote, isCustom }) => {
|
||||
if (excludedObjectNameSingulars?.includes(nameSingular)) {
|
||||
return false;
|
||||
}
|
||||
//TODO - #345 issue - IsSearchable decorator
|
||||
if (isSystem || isRemote) {
|
||||
return false;
|
||||
}
|
||||
|
||||
({ nameSingular, isSearchable }) => {
|
||||
return (
|
||||
isCustom ||
|
||||
['company', 'person', 'opportunity', 'note', 'task'].includes(
|
||||
nameSingular,
|
||||
)
|
||||
!excludedObjectNameSingulars?.includes(nameSingular) && isSearchable
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user