feat(web): T-WEB-005 模型上传 + VRM 优先 + 版本识别

This commit is contained in:
2026-09-14 19:00:55 +08:00
parent ff8c4dd26a
commit 73e793318e
7 changed files with 517 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
import { ModelFormat, PublishStatus, SourceType } from '../common/enums';
import { CharacterModel } from '../entities/model.entity';
/** 契约 data-models.md §4 的对外表示 */
export interface ModelDto {
id: number;
name: string;
format: ModelFormat;
vrmVersion: string | null;
isPrimary: boolean;
fileUrl: string | null;
fileSize: number | null;
thumbnailUrl: string | null;
sourceType: SourceType;
sourceName: string;
sourceUrl: string;
license: string;
author: string;
status: PublishStatus;
createdAt: string;
updatedAt: string;
}
export interface ModelUrlLookup {
fileUrl: string | null;
thumbnailUrl: string | null;
fileSize?: number | null;
}
export function toModelDto(model: CharacterModel, urls: ModelUrlLookup): ModelDto {
return {
id: model.id,
name: model.name,
format: model.format,
vrmVersion: model.vrmVersion,
isPrimary: model.isPrimary,
fileUrl: urls.fileUrl,
fileSize: urls.fileSize ?? null,
thumbnailUrl: urls.thumbnailUrl,
sourceType: model.sourceType,
sourceName: model.sourceName,
sourceUrl: model.sourceUrl,
license: model.license,
author: model.author,
status: model.status,
createdAt: model.createdAt.toISOString(),
updatedAt: model.updatedAt.toISOString(),
};
}