feat(web): T-WEB-004 动作数据上传 + 来源五元组校验

This commit is contained in:
2026-09-14 19:00:55 +08:00
parent d9614aadb0
commit ff8c4dd26a
5 changed files with 430 additions and 0 deletions
@@ -0,0 +1,61 @@
import { MotionFormat, PreprocessState, PublishStatus, SourceType } from '../common/enums';
import { Motion } from '../entities/motion.entity';
/** 契约 data-models.md §3 的对外表示 */
export interface MotionDto {
id: number;
songId: number | null;
name: string;
format: MotionFormat;
fileUrl: string | null;
fileSize: number | null;
fps: number | null;
frameCount: number | null;
durationMs: number | null;
keypointFormat: string | null;
keypointUrl: string | null;
keypointFrames: number | null;
preprocessState: PreprocessState;
preprocessError: string | null;
sourceType: SourceType;
sourceName: string;
sourceUrl: string;
license: string;
author: string;
status: PublishStatus;
createdAt: string;
updatedAt: string;
}
export interface MotionUrlLookup {
fileUrl: string | null;
keypointUrl: string | null;
fileSize?: number | null;
}
export function toMotionDto(motion: Motion, urls: MotionUrlLookup): MotionDto {
return {
id: motion.id,
songId: motion.songId,
name: motion.name,
format: motion.format,
fileUrl: urls.fileUrl,
fileSize: urls.fileSize ?? null,
fps: motion.fps,
frameCount: motion.frameCount,
durationMs: motion.durationMs,
keypointFormat: motion.keypointFormat,
keypointUrl: urls.keypointUrl,
keypointFrames: motion.keypointFrames,
preprocessState: motion.preprocessState,
preprocessError: motion.preprocessError,
sourceType: motion.sourceType,
sourceName: motion.sourceName,
sourceUrl: motion.sourceUrl,
license: motion.license,
author: motion.author,
status: motion.status,
createdAt: motion.createdAt.toISOString(),
updatedAt: motion.updatedAt.toISOString(),
};
}