File size: 1,085 Bytes
11f4e50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import mongoose, { Schema, Document } from 'mongoose';

export interface IProject extends Document {
    userId: mongoose.Types.ObjectId;
    name: string;
    defaultPlatform: 'TikTok' | 'Reels' | 'Shorts' | 'YouTube';
    defaultFormat: '9:16' | '16:9' | '1:1';
    videos: mongoose.Types.ObjectId[];
    createdAt: Date;
}

const ProjectSchema = new Schema<IProject>({
    userId: {
        type: Schema.Types.ObjectId,
        ref: 'User',
        required: true,
    },
    name: {
        type: String,
        required: true,
        trim: true,
    },
    defaultPlatform: {
        type: String,
        enum: ['TikTok', 'Reels', 'Shorts', 'YouTube'],
        default: 'TikTok',
    },
    defaultFormat: {
        type: String,
        enum: ['9:16', '16:9', '1:1'],
        default: '9:16',
    },
    videos: [{
        type: Schema.Types.ObjectId,
        ref: 'Video',
    }],
    createdAt: {
        type: Date,
        default: Date.now,
    },
});

export const Project = mongoose.model<IProject>('Project', ProjectSchema);