Integrate timestamps and uploaders
This commit is contained in:
parent
9dc2743990
commit
199ed6837a
1 changed files with 16 additions and 4 deletions
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Reference in a new issue