Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// construct file schema
const schema = createFileSchema(bucket);
// apply schema plugins with model options
const schemaOptions = _.merge({}, schema.options);
_.forEach([...plugins], plugin => {
schema.plugin(plugin, schemaOptions);
});
// hack(to be removed): fake timestamp fields
schema.statics.CREATED_AT_FIELD = 'uploadDate';
schema.statics.UPDATED_AT_FIELD = 'uploadDate';
// compile file model
const fileModel = model(modelName, schema, connection);
// return model
return fileModel;
}