feat: Implement section access validation for agent filtering and refine filterable field retrieval to include only fields from global or assigned sections.
This commit is contained in:
@@ -235,6 +235,7 @@ export class ProfileFieldsService {
|
||||
/**
|
||||
* Get all filterable fields (public endpoint for search filters)
|
||||
* Returns fields with CHECKBOX_GROUP, SELECT, MULTI_SELECT types that have options
|
||||
* Only includes fields from sections that are global or assigned to at least one agent type
|
||||
* De-duplicates by both slug AND name to handle duplicate fields with different slugs
|
||||
*/
|
||||
async getFilterableFields() {
|
||||
@@ -245,6 +246,14 @@ export class ProfileFieldsService {
|
||||
isActive: true,
|
||||
fieldType: { in: filterableTypes },
|
||||
options: { not: Prisma.JsonNull },
|
||||
// Only include fields from sections that are global or assigned to at least one agent type
|
||||
section: {
|
||||
isActive: true,
|
||||
OR: [
|
||||
{ isGlobal: true },
|
||||
{ agentTypeSections: { some: {} } },
|
||||
],
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
|
||||
Reference in New Issue
Block a user