You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.2 KiB
45 lines
1.2 KiB
// image.js
|
|
// Copyright (C) 2024 DTP Technologies, LLC
|
|
// All Rights Reserved
|
|
|
|
'use strict';
|
|
|
|
import mongoose from 'mongoose';
|
|
const Schema = mongoose.Schema;
|
|
|
|
const ImageSchema = new Schema({
|
|
created: { type: Date, default: Date.now, required: true, index: -1 },
|
|
owner: { type: Schema.ObjectId, required: true, index: 1, ref: 'User' },
|
|
caption: { type: String, maxLength: 300 },
|
|
type: { type: String, required: true },
|
|
size: { type: Number, required: true },
|
|
file: {
|
|
bucket: { type: String, required: true },
|
|
key: { type: String, required: true },
|
|
etag: { type: String, required: true, index: true },
|
|
},
|
|
metadata: {
|
|
format: { type: String },
|
|
size: { type: Number },
|
|
width: { type: Number },
|
|
height: { type: Number },
|
|
space: { type: String },
|
|
channels: { type: Number },
|
|
depth: { type: String },
|
|
density: { type: Number },
|
|
hasAlpha: { type: Boolean },
|
|
orientation: { type: Number },
|
|
},
|
|
});
|
|
|
|
ImageSchema.index({
|
|
'flags.isPendingAttachment': 1,
|
|
created: -1,
|
|
}, {
|
|
partialFilterExpression: {
|
|
'flags.isPendingAttachment': true,
|
|
},
|
|
name: 'img_pendattach_idx',
|
|
});
|
|
|
|
export default mongoose.model('Image', ImageSchema);
|