Integrate timestamps and uploaders

This commit is contained in:
Jose 2020-08-22 21:12:55 -05:00
commit 199ed6837a

View file

@ -1,19 +1,31 @@
import { Document, model, Schema } from 'mongoose'
import shortid from 'shortid'
import moment from 'moment'
const ImgSchema = new Schema({
_id: {
type: String,
default: shortid.generate
},
data: Buffer,
contentType: String
createdAt: {
type: Date,
default: moment().toISOString()
},
uploaders: [String],
img: {
contentType: String,
data: Buffer,
}
})
export type ImgType = Document & {
_id: string,
data: Buffer,
contentType: string
createdAt: Date,
uploaders: string[],
img: {
contentType: string,
data: Buffer
}
}
export default model<ImgType>("Images", ImgSchema, "Images")