(feat:chunks) server-side filter on search

This commit is contained in:
ManishMadan2882
2025-07-25 01:43:50 +05:30
parent 8ede3a0173
commit 58465ece65
4 changed files with 66 additions and 23 deletions

View File

@@ -43,8 +43,11 @@ const endpoints = {
page: number,
per_page: number,
path?: string,
search?: string,
) =>
`/api/get_chunks?id=${docId}&page=${page}&per_page=${per_page}${path ? `&path=${encodeURIComponent(path)}` : ''}`,
`/api/get_chunks?id=${docId}&page=${page}&per_page=${per_page}${
path ? `&path=${encodeURIComponent(path)}` : ''
}${search ? `&search=${encodeURIComponent(search)}` : ''}`,
ADD_CHUNK: '/api/add_chunk',
DELETE_CHUNK: (docId: string, chunkId: string) =>
`/api/delete_chunk?id=${docId}&chunk_id=${chunkId}`,

View File

@@ -87,8 +87,9 @@ const userService = {
perPage: number,
token: string | null,
path?: string,
search?: string,
): Promise<any> =>
apiClient.get(endpoints.USER.GET_CHUNKS(docId, page, perPage, path), token),
apiClient.get(endpoints.USER.GET_CHUNKS(docId, page, perPage, path, search), token),
addChunk: (data: any, token: string | null): Promise<any> =>
apiClient.post(endpoints.USER.ADD_CHUNK, data, token),
deleteChunk: (