import mongoose, { Schema } from "mongoose";
import IPhoto from "../interfaces/IPhoto";

const PhotoSchema: Schema = new Schema<IPhoto>({
    title:{
        type: String,
        trim: true,
        minlength: 1,
        required: [true, 'Title should exist']
    },
    photo:{
        type: String,
        require: true,
        trim: true,
        minlength: 1,
        required: [true, 'Photo should exist']
    },
    user:{
        type: Schema.Types.ObjectId,
        ref: 'User',
        required: [true, 'User data should exist']
    }
}, {versionKey: false})

export const Photo = mongoose.model<IPhoto>('Photo', PhotoSchema)