Title: Link Filter Description: Filter entities by their relationships to other entities Tags: features, filters, relationships --- Link Filter Feature Documentation Overview The Link Filter feature allows users to filter entities by their relationships to other entities. For example, you can filter all real estate properties that are linked to a specific contact like "Yannic Buchwald". How It Works Automatic Activation The link filter automatically appears in the filter panel when: The current entity type has linksConfiguration.enabled = true The type has defined allowedTypes or relationships to other entity types User Interface The link filter provides a two-step selection process: Type Selection: First dropdown allows you to select which type of entity you want to filter by (e.g., "Contacts") Entity Selection: Second dropdown allows you to select the specific entity (e.g., "Yannic Buchwald") Filter Logic When a link filter is applied: The system queries the relations collection to find all relationships involving the selected entity It extracts the IDs of entities that are linked to the selected entity The main data view is filtered to show only those linked entities Example Use Cases Real Estate and Contacts Scenario: You have real estate properties linked to contacts (agents, owners, managers) Usage: Filter all properties where "Yannic Buchwald" is linked as an agent Result: Only properties with Yannic as a linked contact are displayed Projects and Team Members Scenario: You have projects linked to team members Usage: Filter all projects where "John Doe" is assigned Result: Only projects with John as a team member are displayed Technical Implementation Components LinksFilterWidget.svelte: The main filter UI component FilterComponent.svelte: Automatically includes links filter when appropriate DataViewWidget.svelte: Handles the special links filtering logic Database Queries The filter converts to MongoDB queries that: Query the relations collection: { "links.collectionName": targetType, "links.id": selectedEntityId } Extract linked entity IDs from relations Filter main collection: { id: { $in: [linkedEntityIds] } } Translation Keys widgets.dataView.filter.selectType: "Select type..." widgets.dataView.filter.selectEntity: "Select entity..." Configuration Enabling Links for a Type const myType: Type = { // ... other properties linksConfiguration: { enabled: true, allowedTypes: ["tenant-projectId-contactType"], descriptions: { "contactType": [ { de: "Immobilienmakler", en: "Real Estate Agent" }, { de: "Eigentümer", en: "Owner" } ] } } }; Template Integration The feature works seamlessly with existing templates like the Real Estate template, which already defines link configurations for contacts. Testing Unit Tests Located in: packages/client/src/data-widgets/links/LinksFilterWidget.test.ts E2E Tests Located in: apps/backoffice/src/routes/projects/[projectId]/link-filter.e2e.ts Manual Testing Steps Create a project with the Real Estate template Add some contacts (e.g., "Yannic Buchwald", "Max Mustermann") Add real estate properties and link them to contacts Navigate to the real estate data view Click the filter button to open filters Look for "Verknüpfungen" (Links) filter Select "Kontakte" in the first dropdown Select a specific contact in the second dropdown Verify only linked properties are displayed Browser Compatibility The feature uses standard web technologies and should work in all modern browsers that support the base application.