feat: add image management functionality

- Implemented image folder repository with CRUD operations.
- Added image reference repository for managing image references to articles.
- Created image repository for handling image assets, including listing, inserting, updating, and deleting images.
- Introduced image usage repository to track storage usage and quotas for tenants.
- Added SQL queries for image assets, folders, references, and usage.
- Developed image handler for HTTP endpoints to manage images and folders.
- Created database migration scripts for image-related tables and structures.
This commit is contained in:
2026-04-16 20:40:41 +08:00
parent 0a3558fc51
commit 27389164b0
57 changed files with 8063 additions and 153 deletions
+61
View File
@@ -256,6 +256,7 @@ export interface ArticleDetail {
generation_mode: string | null;
platforms: string[];
cover_asset_url: string | null;
cover_image_asset_id: number | null;
generate_status: string;
publish_status: string;
title: string | null;
@@ -278,6 +279,66 @@ export interface UpdateArticleRequest {
markdown_content: string;
platforms?: string[];
cover_asset_url?: string | null;
referenced_image_asset_ids?: number[];
cover_image_asset_id?: number | null;
}
export interface ImageFolder {
id: number;
name: string;
image_count: number;
created_at: string;
}
export interface ImageAssetItem {
id: number;
folder_id: number | null;
name: string;
url: string;
size_bytes: number;
created_at: string;
}
export interface ImageAssetListResponse {
items: ImageAssetItem[];
total: number;
}
export interface ImageUploadResponse {
id: number;
url: string;
name: string;
size_bytes: number;
reused?: boolean;
}
export interface ImageReferenceArticleBrief {
article_id: number;
title: string;
scopes: string[];
}
export interface ImageReferenceDetail {
total: number;
article_body: number;
article_cover: number;
articles: ImageReferenceArticleBrief[];
}
export interface FolderDeletePreview {
image_count: number;
referenced_articles: ImageReferenceArticleBrief[];
}
export interface ImageStorageUsage {
used_bytes: number;
quota_bytes: number;
used_pct: number;
}
export interface ImageUpdateRequest {
name?: string;
folder_id?: number | null;
}
export interface ArticleImageUploadResponse {