working proper seeding

This commit is contained in:
Arjun Patel
2019-03-14 03:56:01 -07:00
parent 064b8df2a0
commit 0880a36ade
6 changed files with 80 additions and 73 deletions
@@ -1,6 +1,7 @@
const db = require('../../config/db.config.js'),
bcrypt = require('bcrypt-nodejs'),
errorMaker = require('../../helpers/error.maker');
errorMaker = require('../../helpers/error.maker'),
uuidv4 = require('uuid/v4');
const { Grant, Cause, Region, Organization } = db;
@@ -74,6 +75,7 @@ exports.create = async (req, res, next) => {
// Store hash in DB
const org = await Organization.create({
id: uuidv4(),
name,
short_description,
@@ -107,6 +109,7 @@ exports.create = async (req, res, next) => {
org
});
} catch (error) {
console.log(error);
await transaction.rollback();
next(error);
}