feat(web): T-WEB-005 模型上传 + VRM 优先 + 版本识别
This commit is contained in:
@@ -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(),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user