feat(product-family): link-level tags (origin_good_tags) with manual override + member detail enrichment

This commit is contained in:
yeuimu
2026-08-28 16:00:46 +08:00
parent 37b52c5ebb
commit 08201f18a4
11 changed files with 477 additions and 87 deletions
+21
View File
@@ -43,6 +43,9 @@ model OriginGood {
detail OriginGoodDetail?
variants OriginGoodVariant[]
mergedIntoGoods GoodOriginGood[]
// 链接级标签:自动派生(manual=false)或人工接管(tagsManual=true 后全部 manual
tagsManual Boolean @default(false) @map("tags_manual")
originGoodTags OriginGoodTag[]
@@index([sdsCategoryId])
@@index([source])
@@ -53,6 +56,23 @@ model OriginGood {
@@map("origin_goods")
}
// ---------- OriginGood-Tag Junction(链接级标签:自动派生 + 人工修正) ----------
model OriginGoodTag {
id BigInt @id @default(autoincrement())
originGoodId BigInt @map("origin_good_id")
tagId BigInt @map("tag_id")
// true = 人工配置(自动同步永不覆盖);false = 按链接名称自动派生
manual Boolean @default(false)
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
originGood OriginGood @relation(fields: [originGoodId], references: [id], onDelete: Cascade, onUpdate: NoAction)
tag Tag @relation(fields: [tagId], references: [id], onDelete: Cascade, onUpdate: NoAction)
@@unique([originGoodId, tagId])
@@index([tagId])
@@map("origin_good_tags")
}
// ---------- Origin Good Details (cached from SDS /products/{id}) ----------
model OriginGoodDetail {
originGoodId BigInt @id @map("origin_good_id")
@@ -182,6 +202,7 @@ model Tag {
goods Good[]
goodTags GoodTag[]
originGoodTags OriginGoodTag[]
tagGroup TagGroup? @relation(fields: [tagGroupId], references: [id], onDelete: SetNull, onUpdate: NoAction)
@@index([tagGroupId])