Implement dynamic group management features with exclusions and mode handling
Enhanced the group management system by introducing dynamic group capabilities, allowing for the exclusion of elements from dynamic groups. Updated the Group and GroupItem models to support a new GroupMode, enabling the distinction between static and dynamic groups. Implemented API endpoints for excluding elements and updated related services to handle group composition based on the selected mode. Improved the frontend to accommodate these changes, including new API functions and UI components for managing exclusions and group modes, thereby enhancing the overall user experience in group management.
This commit is contained in:
@@ -5,6 +5,7 @@ import type {
|
||||
GroupDto,
|
||||
GroupElementKind,
|
||||
GroupFilter,
|
||||
GroupMode,
|
||||
GroupSuggestionDto,
|
||||
GroupSummaryDto,
|
||||
} from '@/shared/api/types'
|
||||
@@ -23,7 +24,13 @@ export function createGroup(body: { name: string; description?: string }) {
|
||||
|
||||
export function updateGroup(
|
||||
id: string,
|
||||
body: { name: string; description: string | null; filter: GroupFilter | null },
|
||||
body: {
|
||||
name: string
|
||||
description: string | null
|
||||
filter: GroupFilter | null
|
||||
/** Не передан — режим остаётся прежним. */
|
||||
mode?: GroupMode
|
||||
},
|
||||
) {
|
||||
return apiRequest<void>(`/admin/groups/${id}`, { method: 'PUT', body })
|
||||
}
|
||||
@@ -63,6 +70,18 @@ export function addGroupElements(
|
||||
})
|
||||
}
|
||||
|
||||
/** Исключить элемент из вычисленного состава динамической группы либо вернуть его правилу. */
|
||||
export function excludeGroupElement(
|
||||
id: string,
|
||||
element: { elementKind: GroupElementKind; elementId: string },
|
||||
excluded: boolean,
|
||||
) {
|
||||
return apiRequest<void>(`/admin/groups/${id}/exclusions`, {
|
||||
method: 'POST',
|
||||
body: { ...element, excluded },
|
||||
})
|
||||
}
|
||||
|
||||
export function removeGroupItem(id: string, itemId: string) {
|
||||
return apiRequest<void>(`/admin/groups/${id}/items/${itemId}`, { method: 'DELETE' })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user