This repository has been archived on 2026-05-01. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
PolyNotFound/backend/app/models/mongodb.model.js
2021-11-02 14:59:31 +01:00

20 lines
545 B
JavaScript

const dbConfig = require("../config/mongodb.config");
const mongoose = require("mongoose");
mongoose.Promise = global.Promise;
const db = {};
db.mongoose = mongoose;
if(typeof process.env.NODE_ENV !== 'undefined' && process.env.NODE_ENV === 'production'){
db.url = dbConfig.prodUrl;
} else {
db.url = dbConfig.devUrl;
}
db.users = require("./user.model")(mongoose);
db.playlists = require("./playlist.model")(mongoose);
db.ads = require("./ad.model")(mongoose);
db.histories = require("./history.model")(mongoose);
module.exports = db;