feat(api): public good detail family block behind gray-release flag

This commit is contained in:
yeuimu
2026-08-28 13:40:19 +08:00
parent b4b9fbbe60
commit 6418aa7302
9 changed files with 324 additions and 6 deletions
@@ -221,6 +221,10 @@ export class ProductFamiliesService {
where: { id: { in: removeIds }, familyId: id },
data: { familyId: null },
});
await this.prisma.good.updateMany({
where: { originGoodId: { in: removeIds }, familyId: id },
data: { familyId: null },
});
// 移除的是主链接(或主链接已不在族内)→ 落到剩余第一个成员
if (remaining > 0) {
const stillPrimary = await this.prisma.originGood.count({
@@ -248,10 +252,12 @@ export class ProductFamiliesService {
}
if (dto.addOriginGoodIds?.length) {
await this.attachMembers(
id,
dto.addOriginGoodIds.map((v) => BigInt(v)),
);
const addIds = dto.addOriginGoodIds.map((v) => BigInt(v));
await this.attachMembers(id, addIds);
await this.prisma.good.updateMany({
where: { originGoodId: { in: addIds } },
data: { familyId: id },
});
}
await this.recompute.recomputeFamily(id);