From 5394dbf5d15856138e4ae93bfd091aae0d2f1811 Mon Sep 17 00:00:00 2001 From: Vytor Calixto <vytorcalixto@gmail.com> Date: Tue, 10 Oct 2017 10:39:51 -0300 Subject: [PATCH] Create download model --- src/libs/models/download.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/libs/models/download.js diff --git a/src/libs/models/download.js b/src/libs/models/download.js new file mode 100644 index 00000000..8cd16000 --- /dev/null +++ b/src/libs/models/download.js @@ -0,0 +1,37 @@ +const mongoose = require('mongoose'); +const Schema = mongoose.Schema; +const libs = `${process.cwd()}/libs`; +const log = require(`${libs}/log`)(module); +const User = require(`${libs}/models/user`); + +let Download = new Schema({ + userId: { + type: Schema.Types.ObjectId, + required: true, + ref: 'User' + }, + table: { + type: String, + required: true + }, + mappingTable: { + type: String, + required: true + }, + query: { + type: String, + required: true + }, + createdAt: { + type: Date, + required: true, + default: Date.now + }, + updatedAt: { + type: Date, + required: true, + default: Date.now + } +}); + +module.exports = mongoose.model('Download', Download); -- GitLab