adjust delete-game-folder

This commit is contained in:
Zamitto 2024-06-04 23:42:44 -03:00
parent 7ac7d92a28
commit 2c26fed478

View File

@ -12,10 +12,18 @@ const deleteGameFolder = async (
gameId: number
): Promise<void> => {
const game = await gameRepository.findOne({
where: {
id: gameId,
isDeleted: false,
},
where: [
{
id: gameId,
isDeleted: false,
status: "removed",
},
{
id: gameId,
progress: 1,
isDeleted: false,
},
],
});
if (!game) return;
@ -33,7 +41,6 @@ const deleteGameFolder = async (
);
}
console.log("folder exists");
return new Promise<void>((resolve, reject) => {
fs.rm(
folderPath,
@ -48,7 +55,6 @@ const deleteGameFolder = async (
}
);
}).then(async () => {
console.log("resolved");
await gameRepository.update(
{ id: gameId },
{ downloadPath: null, folderName: null }