const mongoose = require('mongoose'); const Schema = mongoose.Schema; const photoSchema = new Schema({ filename: { type: String, required: true }, path: { type: String, required: true }, variants: { medium: { type: String }, thumb: { type: String }, }, caption: { type: String, required: true }, tags: { type: [String], required: true }, hash: { type: String, unique: true, sparse: true, index: true } }, { timestamps: true, }); const Photo = mongoose.model('Photo', photoSchema); module.exports = Photo;