mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-25 19:15:18 +02:00
refactor: add sorting functionality to document retrieval and enhance DocumentsSidebar for improved search and pagination handling
This commit is contained in:
parent
0feb17cb75
commit
dc6c18b3f6
5 changed files with 311 additions and 281 deletions
|
|
@ -92,11 +92,16 @@ export const surfsenseDocsDocumentWithChunks = surfsenseDocsDocument.extend({
|
|||
/**
|
||||
* Get documents
|
||||
*/
|
||||
export const documentSortByEnum = z.enum(["created_at", "title", "document_type"]);
|
||||
export const sortOrderEnum = z.enum(["asc", "desc"]);
|
||||
|
||||
export const getDocumentsRequest = z.object({
|
||||
queryParams: paginationQueryParams
|
||||
.extend({
|
||||
search_space_id: z.number().or(z.string()).optional(),
|
||||
document_types: z.array(documentTypeEnum).optional(),
|
||||
sort_by: documentSortByEnum.optional(),
|
||||
sort_order: sortOrderEnum.optional(),
|
||||
})
|
||||
.nullish(),
|
||||
});
|
||||
|
|
@ -311,6 +316,8 @@ export type UpdateDocumentResponse = z.infer<typeof updateDocumentResponse>;
|
|||
export type DeleteDocumentRequest = z.infer<typeof deleteDocumentRequest>;
|
||||
export type DeleteDocumentResponse = z.infer<typeof deleteDocumentResponse>;
|
||||
export type DocumentTypeEnum = z.infer<typeof documentTypeEnum>;
|
||||
export type DocumentSortBy = z.infer<typeof documentSortByEnum>;
|
||||
export type SortOrder = z.infer<typeof sortOrderEnum>;
|
||||
export type SurfsenseDocsChunk = z.infer<typeof surfsenseDocsChunk>;
|
||||
export type SurfsenseDocsDocument = z.infer<typeof surfsenseDocsDocument>;
|
||||
export type SurfsenseDocsDocumentWithChunks = z.infer<typeof surfsenseDocsDocumentWithChunks>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue