Created
October 7, 2022 13:40
-
-
Save AryanJ-NYC/5488840b0ee5b54fd106f2299c8a3343 to your computer and use it in GitHub Desktop.
Helping boltz.fun
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const imgDeletionPromises = imagesToDelete.map((i) => deleteImage(i)); // no awaiting! | |
const [updatedProject] = await([ | |
prisma.project | |
.update({ | |
where: { | |
id, | |
}, | |
data: { | |
title, | |
description, | |
lightning_address, | |
tagline, | |
hashtag, | |
website, | |
discord, | |
github, | |
twitter, | |
slack, | |
telegram, | |
launch_status, | |
...coverImageRel, | |
...thumbnailImageRel, | |
screenshots_ids, | |
category: { | |
connect: { | |
id: category_id, | |
}, | |
}, | |
members: { | |
deleteMany: {}, | |
create: newMembers.map((member) => { | |
return { | |
role: member.role, | |
user: { | |
connect: { | |
id: member.id, | |
}, | |
}, | |
}; | |
}), | |
}, | |
recruit_roles: { | |
deleteMany: {}, | |
create: recruit_roles.map((role) => { | |
return { | |
level: 0, | |
role: { | |
connect: { | |
id: role, | |
}, | |
}, | |
}; | |
}), | |
}, | |
tournaments: { | |
deleteMany: {}, | |
create: tournaments.map((tournament) => { | |
return { | |
tournament: { | |
connect: { | |
id: tournament, | |
}, | |
}, | |
}; | |
}), | |
}, | |
capabilities: { | |
set: capabilities.map((c) => { | |
return { | |
id: c, | |
}; | |
}), | |
}, | |
}, | |
}) | |
.catch((error) => { | |
logError(error); | |
throw new ApolloError("Unexpected error happened..."); | |
}), | |
imagesToAdd.length > 0 && | |
prisma.hostedImage | |
.updateMany({ | |
where: { | |
id: { | |
in: imagesToAdd, | |
}, | |
}, | |
data: { | |
is_used: true, | |
}, | |
}) | |
.catch((error) => { | |
logError(error); | |
throw new ApolloError("Unexpected error happened..."); | |
}), | |
imgDeletionPromises, // awaited here | |
]); | |
// the rest of your code |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment