fix: 处理错误信息字段的空值和空字符串

更新多个文件以确保错误信息字段在处理时将空字符串和未定义值转换为null,增强数据一致性和展示逻辑。包括前端组件和后端服务的相应调整。
This commit is contained in:
dmy
2026-01-14 21:33:35 +08:00
parent 740c11527f
commit 10565af001
4 changed files with 9 additions and 7 deletions

View File

@@ -15,7 +15,7 @@ export class CrawlInfoAdd {
latestPublishDate: Date | null;
@Column({ type: 'text', nullable: true })
error: string;
error: string | null;
@CreateDateColumn()
createdAt: Date;

View File

@@ -318,7 +318,8 @@ export class BidCrawlerService {
source,
count,
latestPublishDate,
error,
// 确保 error 字段正确处理undefined 或空字符串都转换为 null
error: error && error.trim() !== '' ? error : null,
});
await this.crawlInfoRepository.save(crawlInfo);
this.logger.log(`Saved crawl info for ${source}: ${count} items`);