260324:2133 Refactor correspondence & rfa
CI / CD Pipeline / build (push) Failing after 17m3s
CI / CD Pipeline / deploy (push) Has been skipped

This commit is contained in:
admin
2026-03-24 21:33:59 +07:00
parent 42fc9fa502
commit aa82b890a5
42 changed files with 2617 additions and 233 deletions
@@ -10,6 +10,10 @@ export class SearchQueryDto {
@IsOptional()
type?: string; // กรองประเภท: 'rfa', 'correspondence', 'drawing'
@IsString()
@IsOptional()
status?: string; // กรองสถานะ: 'DRAFT', 'SUBOWN', 'CLBOWN', 'CANCELLED', ...
@IsInt()
@Type(() => Number)
@IsOptional()
+2 -1
View File
@@ -108,7 +108,7 @@ export class SearchService implements OnModuleInit {
* ค้นหาเอกสาร (Full-text Search)
*/
async search(queryDto: SearchQueryDto) {
const { q, type, projectId, page = 1, limit = 20 } = queryDto;
const { q, type, status, projectId, page = 1, limit = 20 } = queryDto;
const from = (page - 1) * limit;
// Early fallback if Elasticsearch is not available
@@ -135,6 +135,7 @@ export class SearchService implements OnModuleInit {
// 2. Filter logic
const filterQueries: Record<string, unknown>[] = [];
if (type) filterQueries.push({ term: { type } });
if (status) filterQueries.push({ term: { status } });
if (projectId) filterQueries.push({ term: { projectId } });
try {