Update seller store experience

This commit is contained in:
R524809
2026-09-08 16:19:38 +08:00
parent ceb644a3f9
commit 319887726e
25 changed files with 31417 additions and 127 deletions
+5 -2
View File
@@ -18,9 +18,12 @@ export const listCollectionItemsQuerySchema = z.object({
export const bulkDeleteCollectionItemsRequestSchema = z.object({ ids: z.array(uuid).min(1).max(100) }).strict();
export const clearCollectionItemsRequestSchema = z.object({ confirm: z.literal(true), expected_active_count: z.number().int().min(0) }).strict();
export const retryCollectionAssetsRequestSchema = z.object({ transfer_ids: z.array(uuid).min(1).max(100) }).strict();
/** 将已采集的来源图片候选按需转存为 Atlas 正式素材。 */
export const materializeCollectionAssetsRequestSchema = z.object({ transfer_ids: z.array(uuid).min(1).max(100) }).strict();
export type CreateCollectionItemRequest = z.infer<typeof createCollectionItemRequestSchema>;
export type UpdateCollectionItemRequest = z.infer<typeof updateCollectionItemRequestSchema>;
export type ListCollectionItemsQuery = z.infer<typeof listCollectionItemsQuerySchema>;
export type MaterializeCollectionAssetsRequest = z.infer<typeof materializeCollectionAssetsRequestSchema>;
export type CollectionItem = {
id: string; product_id: string; source: { kind: 'platform' | 'manual'; platform_code: string | null; url: string | null };
@@ -40,7 +43,7 @@ export type CollectionItemInspection = CollectionItem & {
parser_version: string | null;
collected_at: string | null;
variants: Array<{ id: string; source_variant_key: string | null; source_sku: string | null; display_name: string | null; sort_order: number }>;
asset_transfers: Array<{ id: string; source_variant_id: string | null; role: string; source_url: string; status: string; asset_id: string | null; error_payload: unknown; created_at: string; completed_at: string | null }>;
asset_transfers: Array<{ id: string; source_variant_id: string | null; media_type: 'image' | 'video'; poster_url: string | null; role: string; source_url: string; status: string; asset_id: string | null; error_payload: unknown; created_at: string; completed_at: string | null }>;
};
/**
@@ -70,7 +73,7 @@ export const collectedProductPayloadSchema = z.object({
confidence: z.enum(['verified', 'partial']), evidenceRefs: z.array(z.string().min(1).max(300)).max(100),
}).strict()).max(100),
assets: z.array(z.object({
url: z.url(), role: z.enum(['source_main', 'source_sku', 'source_detail']), variantSourceKey: z.string().min(1).max(500).optional(),
url: z.url(), mediaType: z.enum(['image', 'video']).default('image'), posterUrl: z.url().optional(), role: z.enum(['source_main', 'source_sku', 'source_detail']), variantSourceKey: z.string().min(1).max(500).optional(),
relation: z.enum(['variant_direct', 'axis_value', 'product_candidate', 'inherited_product_default']), sortOrder: z.number().int().min(0).max(10_000).default(0), refererOrigin: z.url().optional(), evidenceRef: z.string().max(300).optional(),
}).strict()).max(500),
evidence: z.array(z.object({ ref: z.string().min(1).max(300), kind: z.enum(['page', 'state', 'json_ld', 'dom']), path: z.string().max(1_000).optional(), raw_value: z.string().max(20_000).optional() }).strict()).max(500),
@@ -0,0 +1,14 @@
SET search_path TO atlas, public;
-- `workspace_id` is the tenant boundary and is never nullable. PostgreSQL's
-- unqualified ON DELETE SET NULL on a composite FK clears every referencing
-- column, including workspace_id. Only the optional variant pointer may be
-- cleared when a re-collected source snapshot replaces its variants.
ALTER TABLE collection_asset_transfers
DROP CONSTRAINT collection_asset_transfers_workspace_id_source_variant_id_fkey;
ALTER TABLE collection_asset_transfers
ADD CONSTRAINT collection_asset_transfers_workspace_id_source_variant_id_fkey
FOREIGN KEY (workspace_id, source_variant_id)
REFERENCES product_variants(workspace_id, id)
ON DELETE SET NULL (source_variant_id);
@@ -0,0 +1,5 @@
SET search_path TO atlas, public;
-- Source-image candidates are recorded during collection but are not fetched
-- until the user actually selects one for editing, processing or publishing.
ALTER TYPE processing_status ADD VALUE IF NOT EXISTS 'pending_selection';
@@ -0,0 +1,8 @@
SET search_path TO atlas, public;
ALTER TABLE collection_asset_transfers
ALTER COLUMN status SET DEFAULT 'pending_selection';
CREATE INDEX ix_collection_asset_transfers_pending_selection
ON collection_asset_transfers (workspace_id, collection_item_id, source_snapshot_revision, created_at)
WHERE status = 'pending_selection';
@@ -0,0 +1,10 @@
SET search_path TO atlas, public;
CREATE TYPE collection_media_type AS ENUM ('image', 'video');
ALTER TABLE collection_asset_transfers
ADD COLUMN media_type collection_media_type NOT NULL DEFAULT 'image',
ADD COLUMN poster_url TEXT;
CREATE INDEX collection_asset_transfers_media_status_idx
ON collection_asset_transfers (workspace_id, media_type, status, created_at);
File diff suppressed because one or more lines are too long