c9a4404052
- 公开前端 SPA(根路径 /):首页大搜索框、检索结果、只读商品详情、贡献档案表单 - 公开写入端点 POST /api/public/submissions(无需登录,基础频率限流),投稿进入 submission 待审核队列,不直接写 product - 迁移 0006:submission 投稿表 + community 来源(trust=0.50) - 后台审核队列:列表(待审核/已通过/已驳回) → 查看投稿 → 通过(创建/补全商品 + 记 source=community + 字段级溯源 + 审计 + 重算质量分) / 驳回(记原因) - 公开只读 api 服务内嵌公开 SPA;Dockerfile.prod 增加 node 构建阶段 + 内嵌 dist Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
31 lines
1.4 KiB
SQL
31 lines
1.4 KiB
SQL
-- Community contributions: public users may submit new/supplementary product
|
|
-- archives. Submissions go to a moderation queue and never touch the product
|
|
-- tables until an admin approves them.
|
|
|
|
-- Community source used to record field-level provenance for approved
|
|
-- public contributions (lower trust than manual operator edits).
|
|
INSERT INTO source (name, homepage, license, trust_weight, notes)
|
|
VALUES ('community', NULL, 'user-contributed', 0.50, '公众投稿/众包贡献,经人工审核后收纳')
|
|
ON CONFLICT (name) DO NOTHING;
|
|
|
|
CREATE TABLE IF NOT EXISTS submission (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
gtin VARCHAR(14),
|
|
name TEXT NOT NULL,
|
|
payload JSONB NOT NULL DEFAULT '{}',
|
|
target_product_id UUID REFERENCES product(id) ON DELETE SET NULL,
|
|
result_product_id UUID REFERENCES product(id) ON DELETE SET NULL,
|
|
submitter_name TEXT,
|
|
submitter_contact TEXT,
|
|
note TEXT,
|
|
status VARCHAR(16) NOT NULL DEFAULT 'pending',
|
|
review_note TEXT,
|
|
reviewed_by TEXT,
|
|
reviewed_at TIMESTAMPTZ,
|
|
remote_ip TEXT,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
CONSTRAINT submission_status_chk CHECK (status IN ('pending','approved','rejected'))
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_submission_status ON submission (status, created_at DESC);
|