backend/md-seed-config.js
2020-12-29 14:13:28 +01:00

27 lines
604 B
JavaScript

const mongoose = require('mongoose');
const { ProductSeeder } = require('./src/seeders');
const config = require('./src/config/config');
const mongoURL = config.mongoose.url
/**
* Seeders List
* order is important
* @type {Object}
*/
module.exports.seedersList = {
ProductSeeder,
};
/**
* Connect to mongodb implementation
* @return {Promise}
*/
module.exports.connect = async () =>
await mongoose.connect(mongoURL, { useNewUrlParser: true });
/**
* Drop/Clear the database implementation
* @return {Promise}
*/
module.exports.dropdb = async () => mongoose.connection.db.dropDatabase();