fix: applications cannot be deleted

This commit is contained in:
Andras Bacsai
2023-02-20 11:54:43 +01:00
parent 06563ef921
commit 08ab7a504a
4 changed files with 107 additions and 110 deletions

View File

@@ -640,9 +640,8 @@ export async function restartApplication(
const volumes =
persistentStorage?.map((storage) => {
return `${applicationId}${storage.path.replace(/\//gi, '-')}:${
buildPack !== 'docker' ? '/app' : ''
}${storage.path}`;
return `${applicationId}${storage.path.replace(/\//gi, '-')}:${buildPack !== 'docker' ? '/app' : ''
}${storage.path}`;
}) || [];
const composeVolumes = volumes.map((volume) => {
return {
@@ -737,7 +736,7 @@ export async function deleteApplication(
where: { id },
include: { destinationDocker: true, teams: true }
});
if (teamId === '0' || !application.teams.some((team) => team.id === teamId)) {
if (teamId !== '0' || !application.teams.some((team) => team.id === teamId)) {
throw { status: 403, message: 'You are not allowed to delete this application.' };
}
if (application?.destinationDocker?.id && application.destinationDocker?.network) {
@@ -1428,9 +1427,8 @@ export async function restartPreview(
const volumes =
persistentStorage?.map((storage) => {
return `${applicationId}${storage.path.replace(/\//gi, '-')}:${
buildPack !== 'docker' ? '/app' : ''
}${storage.path}`;
return `${applicationId}${storage.path.replace(/\//gi, '-')}:${buildPack !== 'docker' ? '/app' : ''
}${storage.path}`;
}) || [];
const composeVolumes = volumes.map((volume) => {
return {