fix: change save behaviour for mongoose models

main
Ayush Mukherjee 1 year ago
parent 6a1f2d0f61
commit 971c21cdee

@ -22,10 +22,7 @@ const eventFns = {
create: async (data) => { create: async (data) => {
try { try {
const ev = new events(data) const ev = new events(data)
ev.save((err) => { await ev.save();
if (err)
console.warn(err)
})
} catch (e) { } catch (e) {
console.warn(e) console.warn(e)
} }
@ -48,10 +45,7 @@ const rosterFns = {
create: async (data) => { create: async (data) => {
try { try {
const ev = new rosters(data) const ev = new rosters(data)
ev.save((err) => { await ev.save();
if (err)
console.warn(err)
})
} catch (e) { } catch (e) {
console.warn(e) console.warn(e)
} }
@ -74,10 +68,7 @@ const matchFns = {
create: async (data) => { create: async (data) => {
try { try {
const ev = new matches(data) const ev = new matches(data)
ev.save((err) => { await ev.save();
if (err)
console.warn(err)
})
} catch (e) { } catch (e) {
console.warn(e) console.warn(e)
} }
@ -109,10 +100,7 @@ const streamFns = {
create: async (data) => { create: async (data) => {
try { try {
const ev = new streams(data) const ev = new streams(data)
ev.save((err) => { await ev.save();
if (err)
console.warn(err)
})
} catch (e) { } catch (e) {
console.warn(e) console.warn(e)
} }
@ -135,10 +123,7 @@ const casterFns = {
create: async (data) => { create: async (data) => {
try { try {
const ev = new casters(data) const ev = new casters(data)
ev.save((err) => { await ev.save();
if (err)
console.warn(err)
})
} catch (e) { } catch (e) {
console.warn(e) console.warn(e)
} }
@ -161,10 +146,7 @@ const hostFns = {
create: async (data) => { create: async (data) => {
try { try {
const ev = new hosts(data) const ev = new hosts(data)
ev.save((err) => { await ev.save();
if (err)
console.warn(err)
})
} catch (e) { } catch (e) {
console.warn(e) console.warn(e)
} }
@ -196,10 +178,7 @@ const bracketFns = {
create: async (data) => { create: async (data) => {
try { try {
const ev = new brackets(data) const ev = new brackets(data)
ev.save((err) => { await ev.save();
if (err)
console.warn(err)
})
} catch (e) { } catch (e) {
console.warn(e) console.warn(e)
} }
@ -214,4 +193,4 @@ module.exports = {
'casters': casterFns, 'casters': casterFns,
'hosts': hostFns, 'hosts': hostFns,
'brackets': bracketFns, 'brackets': bracketFns,
} }

Loading…
Cancel
Save