chore: 初始化仓库
中华文明全图鉴——文物全图系统(PC Web 地图 + NestJS API + 管理后台)。 含三大 IP(文物南迁北归 / 国宝海外回归 / 博物馆手艺人)、AI 文物对话、 文物地图与详情、以及 demo-video-kit 演示视频生成工具。
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "@wenwumap/shared",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"scripts": {
|
||||
"type-check": "tsc --noEmit",
|
||||
"lint": "eslint src --ext .ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5.5.3"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
// 文物门类
|
||||
export const ArtifactCategory = {
|
||||
bronze: "bronze",
|
||||
painting_calligraphy: "painting_calligraphy",
|
||||
porcelain: "porcelain",
|
||||
jade: "jade",
|
||||
gold_silver: "gold_silver",
|
||||
lacquer: "lacquer",
|
||||
textile: "textile",
|
||||
stone_carving: "stone_carving",
|
||||
wood_carving: "wood_carving",
|
||||
dunhuang: "dunhuang",
|
||||
ancient_book: "ancient_book",
|
||||
other: "other",
|
||||
} as const;
|
||||
export type ArtifactCategory = (typeof ArtifactCategory)[keyof typeof ArtifactCategory];
|
||||
|
||||
// 文物级别
|
||||
export const ArtifactLevel = {
|
||||
level_1: "level_1",
|
||||
level_2: "level_2",
|
||||
level_3: "level_3",
|
||||
general: "general",
|
||||
unknown: "unknown",
|
||||
} as const;
|
||||
export type ArtifactLevel = (typeof ArtifactLevel)[keyof typeof ArtifactLevel];
|
||||
|
||||
// 文物当前状态
|
||||
export const ArtifactStatus = {
|
||||
at_home: "at_home",
|
||||
away: "away",
|
||||
in_transit: "in_transit",
|
||||
unknown: "unknown",
|
||||
} as const;
|
||||
export type ArtifactStatus = (typeof ArtifactStatus)[keyof typeof ArtifactStatus];
|
||||
|
||||
// 位置类型
|
||||
export const LocationType = {
|
||||
domestic: "domestic",
|
||||
overseas: "overseas",
|
||||
unknown: "unknown",
|
||||
in_transit: "in_transit",
|
||||
} as const;
|
||||
export type LocationType = (typeof LocationType)[keyof typeof LocationType];
|
||||
|
||||
// 坐标精度
|
||||
export const LocationPrecision = {
|
||||
exact_room: "exact_room",
|
||||
exact_building: "exact_building",
|
||||
city: "city",
|
||||
country: "country",
|
||||
region: "region",
|
||||
} as const;
|
||||
export type LocationPrecision = (typeof LocationPrecision)[keyof typeof LocationPrecision];
|
||||
|
||||
// 展出状态
|
||||
export const DisplayStatus = {
|
||||
on_display: "on_display",
|
||||
in_storage: "in_storage",
|
||||
loaned: "loaned",
|
||||
repairing: "repairing",
|
||||
touring: "touring",
|
||||
unknown: "unknown",
|
||||
} as const;
|
||||
export type DisplayStatus = (typeof DisplayStatus)[keyof typeof DisplayStatus];
|
||||
|
||||
// 数据来源类型
|
||||
export const SourceType = {
|
||||
institution_feed: "institution_feed",
|
||||
manual_entry: "manual_entry",
|
||||
user_report: "user_report",
|
||||
expert_verify: "expert_verify",
|
||||
public_source: "public_source",
|
||||
} as const;
|
||||
export type SourceType = (typeof SourceType)[keyof typeof SourceType];
|
||||
|
||||
// 发布状态
|
||||
export const PublishStatus = {
|
||||
draft: "draft",
|
||||
pending: "pending",
|
||||
published: "published",
|
||||
archived: "archived",
|
||||
rejected: "rejected",
|
||||
} as const;
|
||||
export type PublishStatus = (typeof PublishStatus)[keyof typeof PublishStatus];
|
||||
|
||||
// 标签值类型
|
||||
export const TagValueType = {
|
||||
single: "single",
|
||||
multiple: "multiple",
|
||||
boolean: "boolean",
|
||||
text: "text",
|
||||
number: "number",
|
||||
} as const;
|
||||
export type TagValueType = (typeof TagValueType)[keyof typeof TagValueType];
|
||||
|
||||
// 地图视图模式
|
||||
export const MapView = {
|
||||
all: "all",
|
||||
at_home: "at_home",
|
||||
away: "away",
|
||||
south_migration: "south_migration",
|
||||
} as const;
|
||||
export type MapView = (typeof MapView)[keyof typeof MapView];
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from "./enums";
|
||||
export * from "./types";
|
||||
@@ -0,0 +1,185 @@
|
||||
import type {
|
||||
ArtifactCategory,
|
||||
ArtifactLevel,
|
||||
ArtifactStatus,
|
||||
DisplayStatus,
|
||||
LocationPrecision,
|
||||
LocationType,
|
||||
PublishStatus,
|
||||
SourceType,
|
||||
TagValueType,
|
||||
} from "./enums";
|
||||
|
||||
// 通用 API 响应
|
||||
export interface ApiResponse<T> {
|
||||
success: true;
|
||||
data: T;
|
||||
request_id: string;
|
||||
}
|
||||
|
||||
export interface ApiError {
|
||||
success: false;
|
||||
error: {
|
||||
code: string;
|
||||
message: string;
|
||||
details?: unknown[];
|
||||
};
|
||||
request_id: string;
|
||||
}
|
||||
|
||||
// 分页
|
||||
export interface Pagination {
|
||||
page: number;
|
||||
page_size: number;
|
||||
total: number;
|
||||
total_pages: number;
|
||||
}
|
||||
|
||||
export interface PaginatedResult<T> {
|
||||
items: T[];
|
||||
pagination: Pagination;
|
||||
}
|
||||
|
||||
// 坐标
|
||||
export interface GeoPoint {
|
||||
lng: number;
|
||||
lat: number;
|
||||
}
|
||||
|
||||
// 地图统计
|
||||
export interface MapSummary {
|
||||
total_artifacts: number;
|
||||
domestic_count: number;
|
||||
overseas_count: number;
|
||||
on_display_count: number;
|
||||
in_storage_count: number;
|
||||
loaned_count: number;
|
||||
unknown_location_count: number;
|
||||
}
|
||||
|
||||
// 地图点位
|
||||
export interface MapPoint {
|
||||
id: string;
|
||||
type: "artifact";
|
||||
artifact_id: string;
|
||||
name: string;
|
||||
category: ArtifactCategory;
|
||||
dynasty: string | null;
|
||||
level: ArtifactLevel;
|
||||
current_status: ArtifactStatus;
|
||||
display_status: DisplayStatus;
|
||||
precision: LocationPrecision;
|
||||
coordinates: [number, number];
|
||||
story_hook: string | null;
|
||||
persona_quote: string | null;
|
||||
institution: {
|
||||
id: string;
|
||||
name: string;
|
||||
} | null;
|
||||
}
|
||||
|
||||
export interface MapCluster {
|
||||
id: string;
|
||||
type: "cluster";
|
||||
count: number;
|
||||
coordinates: [number, number];
|
||||
}
|
||||
|
||||
export interface MapPointsResult {
|
||||
points: MapPoint[];
|
||||
clusters: MapCluster[];
|
||||
}
|
||||
|
||||
// 机构
|
||||
export interface Institution {
|
||||
id: string;
|
||||
name: string;
|
||||
short_name: string | null;
|
||||
institution_type: string;
|
||||
country: string;
|
||||
province: string | null;
|
||||
city: string | null;
|
||||
address: string | null;
|
||||
location: GeoPoint | null;
|
||||
official_website: string | null;
|
||||
description: string | null;
|
||||
is_verified: boolean;
|
||||
publish_status: PublishStatus;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
// 文物(列表卡片)
|
||||
export interface ArtifactCard {
|
||||
id: string;
|
||||
unified_map_id: string;
|
||||
name: string;
|
||||
category: ArtifactCategory;
|
||||
dynasty: string | null;
|
||||
level: ArtifactLevel;
|
||||
current_status: ArtifactStatus;
|
||||
story_hook: string | null;
|
||||
persona_quote: string | null;
|
||||
institution: {
|
||||
id: string;
|
||||
name: string;
|
||||
} | null;
|
||||
current_location: {
|
||||
display_status: DisplayStatus;
|
||||
location_type: LocationType;
|
||||
precision: LocationPrecision;
|
||||
source_type: SourceType;
|
||||
verified_at: string | null;
|
||||
} | null;
|
||||
cover_image: string | null;
|
||||
}
|
||||
|
||||
// 文物(详情页)
|
||||
export interface ArtifactDetail extends ArtifactCard {
|
||||
alternative_names: string[];
|
||||
material: string | null;
|
||||
dimensions: string | null;
|
||||
summary: string | null;
|
||||
home_institution_id: string | null;
|
||||
publish_status: PublishStatus;
|
||||
tags: ArtifactTag[];
|
||||
assets: DigitalAsset[];
|
||||
}
|
||||
|
||||
// 文物标签
|
||||
export interface ArtifactTag {
|
||||
id: string;
|
||||
tag_id: string;
|
||||
tag_name: string;
|
||||
tag_category: string;
|
||||
value_text: string | null;
|
||||
source_type: SourceType;
|
||||
review_status: "pending" | "approved" | "rejected";
|
||||
}
|
||||
|
||||
// 标签
|
||||
export interface Tag {
|
||||
id: string;
|
||||
category_id: string;
|
||||
code: string;
|
||||
name: string;
|
||||
value_type: TagValueType;
|
||||
description: string | null;
|
||||
color: string | null;
|
||||
icon: string | null;
|
||||
is_active: boolean;
|
||||
sort_order: number;
|
||||
}
|
||||
|
||||
// 数字资产
|
||||
export interface DigitalAsset {
|
||||
id: string;
|
||||
asset_type: "image" | "audio" | "video" | "model_3d" | "document";
|
||||
title: string | null;
|
||||
url: string;
|
||||
thumbnail_url: string | null;
|
||||
mime_type: string | null;
|
||||
size_bytes: number | null;
|
||||
copyright_owner: string | null;
|
||||
sort_order: number;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": "./src",
|
||||
"outDir": "./dist"
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
Reference in New Issue
Block a user