/img (fixed)

Błędy rzucane przez multer są teraz obsługiwane poprawnie
This commit is contained in:
2020-12-09 16:41:08 +01:00
parent f2dce7b5ae
commit 609f18291c
3 changed files with 20 additions and 16 deletions

View File

@@ -126,7 +126,7 @@ async function startTrial(restaurantId, userData) {
throw newError("Nie udało się pobrać restauracji.", 404);
});
if (!userData.trialUsed || userData.trialUsed === false) {
const dueDate = dueDateBasedOnSubscription(restaurant, monthsToAdd);
const dueDate = dueDateBasedOnSubscription(restaurant, 3);
const start = startDate(restaurant);
await Restaurant.findByIdAndUpdate(restaurantId, {
$set: {
@@ -140,6 +140,9 @@ async function startTrial(restaurantId, userData) {
500
);
});
await User.findByIdAndUpdate(userData.id, { $set: { trialUsed: true } }).catch((e) => {
throw newError("Błąd podczas aktywacji okresu próbnego (user data)")
})
} else {
throw newError("Okres próbny został już wykorzystany.", 500);
}