251127:1700 Frontend Start Build

This commit is contained in:
admin
2025-11-27 17:08:49 +07:00
parent b42c8c0c9f
commit f725bd5d3e
1795 changed files with 893474 additions and 10 deletions

View File

@@ -0,0 +1,26 @@
// File: lib/services/search.service.ts
import apiClient from "@/lib/api/client";
import { SearchQueryDto } from "@/types/dto/search/search-query.dto";
export const searchService = {
/**
* ค้นหาเอกสารทั้งระบบ (Full-text Search)
* ใช้ Elasticsearch ผ่าน Backend
*/
search: async (query: SearchQueryDto) => {
// ส่ง params แบบ flat ตาม DTO
// GET /search?q=...&type=...&projectId=...
const response = await apiClient.get("/search", {
params: query
});
return response.data;
},
/**
* (Optional) Re-index ข้อมูลใหม่ กรณีข้อมูลไม่ตรง (Admin Only)
*/
reindex: async (type?: string) => {
const response = await apiClient.post("/search/reindex", { type });
return response.data;
}
};