82 lines
1.6 KiB
TypeScript
82 lines
1.6 KiB
TypeScript
/**
|
|
* rSplat Automerge document schemas.
|
|
*
|
|
* Granularity: one Automerge document per space (all splats together).
|
|
* DocId format: {space}:splat:scenes
|
|
*
|
|
* 3D files stay on the filesystem — only metadata migrates.
|
|
*/
|
|
|
|
import type { DocSchema } from '../../shared/local-first/document';
|
|
|
|
// ── Document types ──
|
|
|
|
export interface SourceFile {
|
|
id: string;
|
|
splatId: string;
|
|
filePath: string;
|
|
fileName: string;
|
|
mimeType: string | null;
|
|
fileSizeBytes: number;
|
|
createdAt: number;
|
|
}
|
|
|
|
export interface SplatItem {
|
|
id: string;
|
|
slug: string;
|
|
title: string;
|
|
description: string;
|
|
filePath: string;
|
|
fileFormat: string;
|
|
fileSizeBytes: number;
|
|
tags: string[];
|
|
spaceSlug: string;
|
|
contributorId: string | null;
|
|
contributorName: string | null;
|
|
source: string | null;
|
|
status: string;
|
|
viewCount: number;
|
|
paymentTx: string | null;
|
|
paymentNetwork: string | null;
|
|
createdAt: number;
|
|
processingStatus: string | null;
|
|
processingError: string | null;
|
|
sourceFileCount: number;
|
|
sourceFiles: SourceFile[];
|
|
}
|
|
|
|
export interface SplatScenesDoc {
|
|
meta: {
|
|
module: string;
|
|
collection: string;
|
|
version: number;
|
|
spaceSlug: string;
|
|
createdAt: number;
|
|
};
|
|
items: Record<string, SplatItem>;
|
|
}
|
|
|
|
// ── Schema registration ──
|
|
|
|
export const splatScenesSchema: DocSchema<SplatScenesDoc> = {
|
|
module: 'splat',
|
|
collection: 'scenes',
|
|
version: 1,
|
|
init: (): SplatScenesDoc => ({
|
|
meta: {
|
|
module: 'splat',
|
|
collection: 'scenes',
|
|
version: 1,
|
|
spaceSlug: '',
|
|
createdAt: Date.now(),
|
|
},
|
|
items: {},
|
|
}),
|
|
};
|
|
|
|
// ── Helpers ──
|
|
|
|
export function splatScenesDocId(space: string) {
|
|
return `${space}:splat:scenes` as const;
|
|
}
|