director-ai / server /src /models /Video.ts
algorembrant's picture
Upload 79 files
11f4e50 verified
import mongoose, { Schema, Document } from 'mongoose';
export interface IVideoAsset {
type: 'clip' | 'image' | 'logo';
path: string;
}
export interface IVideoVoice {
type: string;
language: string;
tone: string;
speed: number;
}
export interface IExportUrl {
format: string;
quality: string;
url: string;
}
export interface IVideo extends Document {
projectId: mongoose.Types.ObjectId;
script: string;
voice: IVideoVoice;
music: {
filePath: string;
};
stylePreset: mongoose.Types.ObjectId;
assets: IVideoAsset[];
status: 'pending' | 'generating' | 'preview' | 'exported' | 'failed';
previewUrl: string;
exportUrls: IExportUrl[];
cliLog: string[];
createdAt: Date;
}
const VideoSchema = new Schema<IVideo>({
projectId: {
type: Schema.Types.ObjectId,
ref: 'Project',
required: true,
},
script: {
type: String,
required: true,
},
voice: {
type: {
type: String,
default: 'neutral',
},
language: {
type: String,
default: 'en',
},
tone: {
type: String,
default: 'professional',
},
speed: {
type: Number,
default: 1.0,
},
},
music: {
filePath: {
type: String,
default: '',
},
},
stylePreset: {
type: Schema.Types.ObjectId,
ref: 'Preset',
},
assets: [{
type: {
type: String,
enum: ['clip', 'image', 'logo'],
},
path: String,
}],
status: {
type: String,
enum: ['pending', 'generating', 'preview', 'exported', 'failed'],
default: 'pending',
},
previewUrl: {
type: String,
default: '',
},
exportUrls: [{
format: String,
quality: String,
url: String,
}],
cliLog: [{
type: String,
}],
createdAt: {
type: Date,
default: Date.now,
},
});
export const Video = mongoose.model<IVideo>('Video', VideoSchema);