27 lines
604 B
JavaScript
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();
|