Reset default tag on delete

This commit is contained in:
Eldad Fux 2020-07-22 17:36:39 +03:00
parent 9cc5b50b6d
commit 8630a3a427

View file

@ -507,6 +507,16 @@ App::delete('/v1/functions/:functionId/tags/:tagId')
}
}
if($function->getAttribute('tag') === $tag->getId()) { // Reset function tag
$function = $projectDB->updateDocument(array_merge($function->getArrayCopy(), [
'tag' => '',
]));
if (false === $function) {
throw new Exception('Failed saving function to DB', 500);
}
}
$usage
->setParam('storage', $tag->getAttribute('codeSize', 0) * -1)
;