Files
goods/migrations/0006_submissions.up.sql
oyaegeli98668 c9a4404052
CI / Go (api) (pull_request) Failing after 20s
CI / Python (ingestion) (pull_request) Successful in 8s
CI / Migrations (postgres) (pull_request) Failing after 17s
feat: 公开首页(搜索+商品详情) + 好心人投稿 + 后台审核收纳
- 公开前端 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>
2026-06-20 05:11:07 +00:00

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);