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

Loading…
Cancel
Save