From 4cbdf0b5034a5eb4bd5e6b108e38ebf4d407111f Mon Sep 17 00:00:00 2001 From: hailin Date: Mon, 12 Jan 2026 01:45:10 -0800 Subject: [PATCH] =?UTF-8?q?fix(auth):=20=E4=BF=AE=E5=A4=8D=20CDC=20consume?= =?UTF-8?q?r=20=E7=B1=BB=E5=9E=8B=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 使用 ?? 运算符正确处理可选字段: - update 使用 undefined 保持字段不变 - create 使用 null 明确设置为空值 Co-Authored-By: Claude Opus 4.5 --- .../messaging/cdc/legacy-user-cdc.consumer.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/services/auth-service/src/infrastructure/messaging/cdc/legacy-user-cdc.consumer.ts b/backend/services/auth-service/src/infrastructure/messaging/cdc/legacy-user-cdc.consumer.ts index 5bcc92b1..4a5dc495 100644 --- a/backend/services/auth-service/src/infrastructure/messaging/cdc/legacy-user-cdc.consumer.ts +++ b/backend/services/auth-service/src/infrastructure/messaging/cdc/legacy-user-cdc.consumer.ts @@ -137,8 +137,8 @@ export class LegacyUserCdcConsumer implements OnModuleInit, OnModuleDestroy { await this.prisma.syncedLegacyUser.upsert({ where: { legacyId: BigInt(user.user_id) }, update: { - phone: user.phone_number || null, - passwordHash: user.password_hash || null, + phone: user.phone_number ?? undefined, + passwordHash: user.password_hash ?? undefined, accountSequence: user.account_sequence, status: user.status, sourceSequenceNum: sequenceNum, @@ -146,8 +146,8 @@ export class LegacyUserCdcConsumer implements OnModuleInit, OnModuleDestroy { }, create: { legacyId: BigInt(user.user_id), - phone: user.phone_number || null, - passwordHash: user.password_hash || null, + phone: user.phone_number ?? null, + passwordHash: user.password_hash ?? null, accountSequence: user.account_sequence, status: user.status, legacyCreatedAt: new Date(user.registered_at),