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