Commit df6397d6e06431ca233fe492d2fa6e694eac3cd1

Authored by Wesnydy Ribeiro
1 parent 4175797c

include database on project and video model schema

translate-api/config/db.js 0 → 100644
... ... @@ -0,0 +1,30 @@
  1 +/**
  2 + * Author: Laércio S. Bezerra
  3 + * Email: laerciosouza@lavid.ufpb.br
  4 + */
  5 +
  6 +/*
  7 + * MongoDB Settings Connection
  8 + */
  9 +'use strict';
  10 +
  11 +/*
  12 + * Required Lib.
  13 + */
  14 +var mongoose = require('mongoose');
  15 +
  16 +/*
  17 + * My Lib for javascript Promises
  18 + */
  19 +mongoose.Promise = require('bluebird');
  20 +
  21 +/*
  22 + * Connection
  23 + */
  24 +mongoose.connect('mongodb://localhost/container_contents', function(err) {
  25 + if(err) {
  26 + console.log('MongoDB connection error: ', err);
  27 + } else {
  28 + console.log('MongoDB connection successful');
  29 + };
  30 +});
... ...
translate-api/models/video.js 0 → 100644
... ... @@ -0,0 +1,28 @@
  1 +/**
  2 + * Author: Wesnydy Lima Ribeiro
  3 + * Email: wesnydy@lavid.ufpb.br
  4 + */
  5 +
  6 +/*
  7 + * Video Model
  8 + */
  9 +
  10 +'use strict';
  11 +
  12 +/**
  13 + * Required libs.
  14 + */
  15 +var mongoose = require('mongoose');
  16 +var Schema = mongoose.Schema;
  17 +
  18 +/**
  19 + * Model Schema
  20 + */
  21 +var videoSchema = new Schema({
  22 + file: { type: String, required: false },
  23 + size: { type: Number, required: false },
  24 + duration: { type: Number, required: false },
  25 + status: { type: String, required: true }
  26 +}, { timestamps: { createdAt: 'created_at' }, versionKey: false });
  27 +
  28 +module.exports = mongoose.model('Video', videoSchema);
... ...