update profile section

This commit is contained in:
pradeepkumar
2026-01-24 15:33:11 +05:30
parent 758a84b20e
commit 37612dd001
7 changed files with 552 additions and 13 deletions

View File

@@ -37,6 +37,8 @@ export type {
UpdateSectionDto,
AssignSectionDto,
UpdateAssignmentDto,
SectionOrderItem,
AgentTypeSectionsResponse,
} from './profile-sections.service';
// Profile Fields Service

View File

@@ -66,6 +66,26 @@ export interface UpdateAssignmentDto {
isRequired?: boolean;
}
export interface SectionOrderItem {
sectionId: string;
sortOrder: number;
isRequired?: boolean;
}
export interface AgentTypeSectionsResponse {
agentType: {
id: string;
name: string;
description: string | null;
};
sections: (ProfileSection & {
isRequired: boolean;
isGlobal: boolean;
effectiveSortOrder: number;
hasCustomOrder: boolean;
})[];
}
// Profile Sections Service
class ProfileSectionsService {
private basePath = '/profile-sections';
@@ -121,6 +141,26 @@ class ProfileSectionsService {
async removeFromAgentType(sectionId: string, agentTypeId: string): Promise<void> {
await api.delete(`${this.basePath}/${sectionId}/assignment/${agentTypeId}`);
}
// Agent Type Sections methods
async getSectionsForAgentType(agentTypeId: string, includeFields = true): Promise<AgentTypeSectionsResponse> {
const url = includeFields
? `${this.basePath}/agent-type/${agentTypeId}`
: `${this.basePath}/agent-type/${agentTypeId}?includeFields=false`;
const response = await api.get<ApiResponse<AgentTypeSectionsResponse>>(url);
return response.data.data;
}
async updateSectionOrderForAgentType(
agentTypeId: string,
sectionOrders: SectionOrderItem[]
): Promise<{ success: boolean; updated: number }> {
const response = await api.patch<ApiResponse<{ success: boolean; updated: number }>>(
`${this.basePath}/agent-type/${agentTypeId}/order`,
{ sectionOrders }
);
return response.data.data;
}
}
export const profileSectionsService = new ProfileSectionsService();