mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-27 01:36:30 +02:00
feat(search-spaces): add deleteSearchSpace endpoint to API service
This commit is contained in:
parent
80357d450b
commit
172f58f742
1 changed files with 19 additions and 0 deletions
|
|
@ -1,10 +1,13 @@
|
|||
import {
|
||||
type CreateSearchSpaceRequest,
|
||||
type DeleteSearchSpaceRequest,
|
||||
type GetSearchSpaceRequest,
|
||||
type GetSearchSpacesRequest,
|
||||
type UpdateSearchSpaceRequest,
|
||||
createSearchSpaceRequest,
|
||||
createSearchSpaceResponse,
|
||||
deleteSearchSpaceRequest,
|
||||
deleteSearchSpaceResponse,
|
||||
getCommunityPromptsResponse,
|
||||
getSearchSpaceRequest,
|
||||
getSearchSpaceResponse,
|
||||
|
|
@ -104,6 +107,22 @@ class SearchSpacesApiService {
|
|||
body: parsedRequest.data.data,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Delete a search space
|
||||
*/
|
||||
deleteSearchSpace = async (request: DeleteSearchSpaceRequest) => {
|
||||
const parsedRequest = deleteSearchSpaceRequest.safeParse(request);
|
||||
|
||||
if (!parsedRequest.success) {
|
||||
console.error("Invalid request:", parsedRequest.error);
|
||||
|
||||
const errorMessage = parsedRequest.error.errors.map((err) => err.message).join(", ");
|
||||
throw new ValidationError(`Invalid request: ${errorMessage}`);
|
||||
}
|
||||
|
||||
return baseApiService.delete(`/api/v1/searchspaces/${request.id}`, deleteSearchSpaceResponse);
|
||||
};
|
||||
}
|
||||
|
||||
export const searchSpacesApiService = new SearchSpacesApiService();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue