|
|
@@ -6,10 +6,10 @@ import loggerFactory from '~/utils/logger';
|
|
|
// eslint-disable-next-line no-unused-vars
|
|
|
const path = require('path');
|
|
|
|
|
|
+const { addSeconds } = require('date-fns');
|
|
|
const mongoose = require('mongoose');
|
|
|
-const uniqueValidator = require('mongoose-unique-validator');
|
|
|
const mongoosePaginate = require('mongoose-paginate-v2');
|
|
|
-const { addSeconds } = require('date-fns');
|
|
|
+const uniqueValidator = require('mongoose-unique-validator');
|
|
|
|
|
|
// eslint-disable-next-line no-unused-vars
|
|
|
const logger = loggerFactory('growi:models:attachment');
|
|
|
@@ -32,9 +32,10 @@ module.exports = function(crowi) {
|
|
|
originalName: { type: String },
|
|
|
fileFormat: { type: String, required: true },
|
|
|
fileSize: { type: Number, default: 0 },
|
|
|
- createdAt: { type: Date, default: Date.now },
|
|
|
temporaryUrlCached: { type: String },
|
|
|
temporaryUrlExpiredAt: { type: Date },
|
|
|
+ }, {
|
|
|
+ timestamps: { createdAt: true, updatedAt: false },
|
|
|
});
|
|
|
attachmentSchema.plugin(uniqueValidator);
|
|
|
attachmentSchema.plugin(mongoosePaginate);
|
|
|
@@ -67,7 +68,6 @@ module.exports = function(crowi) {
|
|
|
attachment.fileName = fileName;
|
|
|
attachment.fileFormat = fileFormat;
|
|
|
attachment.fileSize = fileSize;
|
|
|
- attachment.createdAt = Date.now();
|
|
|
|
|
|
return attachment;
|
|
|
};
|