fix(customers): 保存阴历生日时避免类型收窄导致构建失败
编辑旧商户时保留阴历类型,类型上写成 1 | 2,不再把字段收成只能是 1。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -117,9 +117,12 @@ export async function updateCustomer(
|
||||
where: { id },
|
||||
select: { birthdayType: true },
|
||||
});
|
||||
const data = toData(r.data);
|
||||
const parsed = toData(r.data);
|
||||
// 改版前的阴历生日不能在保存其它字段时改成阳历,否则明年提醒日会错
|
||||
if (existing?.birthdayType === 2) data.birthdayType = 2;
|
||||
const data = {
|
||||
...parsed,
|
||||
birthdayType: existing?.birthdayType === 2 ? 2 : parsed.birthdayType,
|
||||
};
|
||||
|
||||
await prisma.customer.update({ where: { id }, data });
|
||||
revalidatePath("/customers");
|
||||
|
||||
Reference in New Issue
Block a user