feat: 回填旧服务的业务提供项关联

This commit is contained in:
que01 committed 2026-09-21 16:31:50 +08:00
1 parent 600b1d64b4
commit 537838532a
3 files changed
+76 -11

No files matched your search

+15 -3
View File
@@ -396,8 +396,14 @@ test("admin can read and update brand and service configuration", async () => {
},
});
assert.equal(createdService.statusCode, 201);
createdServiceId = JSON.parse(createdService.body).id;
assert.equal(JSON.parse(createdService.body).categoryKey, "consulting");
const createdServiceBody = JSON.parse(createdService.body);
createdServiceId = createdServiceBody.id;
assert.equal(createdServiceBody.categoryKey, "consulting");
assert.ok(createdServiceBody.offeringId);
const createdOffering = await prisma.offering.findUnique({
where: { id: createdServiceBody.offeringId },
});
assert.equal(createdOffering?.name, "集成测试通用服务");
} finally {
await prisma.brandProfile.update({
where: { id: brandId },
@@ -411,7 +417,12 @@ test("admin can read and update brand and service configuration", async () => {
where: { id: serviceBefore.id },
data: { priceText: serviceBefore.priceText, sortOrder: serviceBefore.sortOrder },
});
if (createdServiceId) await prisma.service.delete({ where: { id: createdServiceId } });
if (createdServiceId) {
const deletedService = await prisma.service.delete({ where: { id: createdServiceId } });
if (deletedService.offeringId) {
await prisma.offering.delete({ where: { id: deletedService.offeringId } });
}
}
}
});
@@ -521,6 +532,7 @@ test("customer can create and cancel a package booking", async () => {
where: { brandId, isEnabled: true, priceAmount: { not: null } },
});
assert.ok(service);
assert.ok(service.offeringId);
const created = await request("/customer/bookings", {
method: "POST",
headers: { authorization: `Bearer ${customerToken}` },