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 { Document, model, Schema } from 'mongoose'
|
||||||
import shortid from 'shortid'
|
import shortid from 'shortid'
|
||||||
|
import moment from 'moment'
|
||||||
|
|
||||||
const ImgSchema = new Schema({
|
const ImgSchema = new Schema({
|
||||||
_id: {
|
_id: {
|
||||||
type: String,
|
type: String,
|
||||||
default: shortid.generate
|
default: shortid.generate
|
||||||
},
|
},
|
||||||
|
createdAt: {
|
||||||
|
type: Date,
|
||||||
|
default: moment().toISOString()
|
||||||
|
},
|
||||||
|
uploaders: [String],
|
||||||
|
img: {
|
||||||
|
contentType: String,
|
||||||
data: Buffer,
|
data: Buffer,
|
||||||
contentType: String
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
export type ImgType = Document & {
|
export type ImgType = Document & {
|
||||||
_id: string,
|
_id: string,
|
||||||
data: Buffer,
|
createdAt: Date,
|
||||||
contentType: string
|
uploaders: string[],
|
||||||
|
img: {
|
||||||
|
contentType: string,
|
||||||
|
data: Buffer
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default model<ImgType>("Images", ImgSchema, "Images")
|
export default model<ImgType>("Images", ImgSchema, "Images")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue