Merge #55 into develop from fix/user_summary
[fix]Allow null to be passed in for hire_date. * fix/user_summary: (3 commits) [fix]Allow null to be passed in for hire_date. [fix]Allow null to be passed in for hire_date. Merge branch 'fix/user_summary' of codeup.aliyun.com:redbearai/python/redbear-m... Signed-off-by: 乐力齐 <accounts_690c7b0af9007d7e338af636@mail.teambition.com> Reviewed-by: aliyun6762716068 <accounts_68cb7c6b61f5dcc4200d6251@mail.teambition.com> Merged-by: aliyun6762716068 <accounts_68cb7c6b61f5dcc4200d6251@mail.teambition.com> CR-link: https://codeup.aliyun.com/redbearai/python/redbear-mem-open/change/55
This commit is contained in:
@@ -343,11 +343,11 @@ async def update_end_user_profile(
|
|||||||
api_logger.warning(f"终端用户不存在: end_user_id={end_user_id}")
|
api_logger.warning(f"终端用户不存在: end_user_id={end_user_id}")
|
||||||
return fail(BizCode.INVALID_PARAMETER, "终端用户不存在", f"end_user_id={end_user_id}")
|
return fail(BizCode.INVALID_PARAMETER, "终端用户不存在", f"end_user_id={end_user_id}")
|
||||||
|
|
||||||
# 更新字段(只更新提供的非 None 字段,排除 end_user_id)
|
# 更新字段(只更新提供的字段,排除 end_user_id)
|
||||||
|
# 允许 None 值来重置字段(如 hire_date)
|
||||||
update_data = profile_update.model_dump(exclude_unset=True, exclude={'end_user_id'})
|
update_data = profile_update.model_dump(exclude_unset=True, exclude={'end_user_id'})
|
||||||
for field, value in update_data.items():
|
for field, value in update_data.items():
|
||||||
if value is not None:
|
setattr(end_user, field, value)
|
||||||
setattr(end_user, field, value)
|
|
||||||
|
|
||||||
# 更新 updated_at 时间戳
|
# 更新 updated_at 时间戳
|
||||||
end_user.updated_at = datetime.datetime.now()
|
end_user.updated_at = datetime.datetime.now()
|
||||||
|
|||||||
Reference in New Issue
Block a user