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
+8
View File
@@ -122,11 +122,17 @@ export class GoodsService {
);
await this.ensureMergedOriginGoods(mergedIds);
const result = await this.prisma.$transaction(async (tx) => {
// Good 的族是派生数据:主链接所属族
const primary = await tx.originGood.findUnique({
where: { id: BigInt(dto.originGoodId) },
select: { familyId: true },
});
const created = await tx.good.create({
data: {
goodName: dto.goodName,
goodImage: dto.goodImage,
originGoodId: BigInt(dto.originGoodId),
familyId: primary?.familyId ?? null,
countryId: BigInt(dto.countryId),
categoryId: BigInt(dto.categoryId),
positionId: dto.positionId === undefined ? null : BigInt(dto.positionId),
@@ -217,6 +223,7 @@ export class GoodsService {
const good = await tx.good.create({
data: {
originGoodId: originGood.id,
familyId: family?.id ?? null,
countryId: BigInt(dto.countryId),
categoryId: BigInt(dto.categoryId),
positionId:
@@ -445,6 +452,7 @@ export class GoodsService {
goodName: og.goodName ?? `Origin Good ${og.sdsGoodId}`,
goodImage: og.goodImage,
originGoodId: og.id,
familyId: og.familyId,
countryId: BigInt(dto.countryId),
categoryId: BigInt(dto.categoryId),
positionId: dto.positionId === undefined ? null : BigInt(dto.positionId),