feat(goods): per-member detail tabs in edit dialog; revert right-tree to raw names; split configured/family badges; add GET /origin-goods/:id

This commit is contained in:
yeuimu
2026-08-28 16:55:07 +08:00
parent 753b554413
commit f28f51155f
7 changed files with 281 additions and 151 deletions
@@ -175,6 +175,54 @@ export class OriginGoodsService {
return this.getTags(id);
}
/** 单链接详情(含 detail 与 variants,成员展开面板用) */
async findOne(id: bigint) {
const og = await this.prisma.originGood.findUnique({
where: { id },
include: {
detail: true,
variants: { orderBy: [{ sortOrder: 'asc' }, { id: 'asc' }] },
_count: { select: { variants: true } },
},
});
if (!og) throw new NotFoundException(`Origin good ${id} not found`);
const detail = og.detail;
return {
id: og.id.toString(),
sdsGoodId: og.sdsGoodId,
goodName: og.goodName,
goodImage: og.goodImage,
goodPrice: og.goodPrice === null || og.goodPrice === undefined ? null : og.goodPrice.toString(),
source: og.source,
delisted: og.delisted,
hasDetail: Boolean(detail),
detailSyncedAt: detail?.syncedAt.toISOString() ?? null,
variantCount: og._count.variants,
detail: detail
? {
productCode: detail.productCode,
englishName: detail.englishName,
productionCycleHours: detail.productionCycleHours,
minWeightG: detail.minWeightG === null ? null : detail.minWeightG.toString(),
productionProcess: detail.productionProcess,
materialDescription: detail.materialDescription,
sizeChart: (detail.sizeChart ?? null) as unknown,
packageSpecs: (detail.packageSpecs ?? null) as unknown,
}
: null,
variants: og.variants.map((v) => ({
sdsVariantId: v.sdsVariantId,
sku: v.sku,
sizeId: v.sizeId,
sizeName: v.sizeName,
colorId: v.colorId,
colorName: v.colorName,
price: v.price === null ? null : v.price.toString(),
enabled: v.enabled,
})),
};
}
async findAll(query: QueryOriginGoodDto): Promise<PaginatedOriginGoods> {
const { page, pageSize, keyword } = query;
const where: Prisma.OriginGoodWhereInput = {