basic seed files and restructuring

This commit is contained in:
Arjun Patel
2019-03-13 21:22:01 -07:00
parent 66173a978b
commit 0c88460b54
26 changed files with 104 additions and 202 deletions
@@ -54,11 +54,8 @@ exports.create = async (req, res, next) => {
});
// cause or region not found
if (!causes.length) {
await Cause.create({ name: primary_cause }, { transaction });
}
if (!regions.length) {
await Region.create({ name: primary_region }, { transaction });
if (!causes.length || !regions.length) {
throw errorMaker(400, `No valid cause or region`);
}
const saltRounds = await bcrypt.genSaltSync(10);