From 28a259e80e25cc5e6ff2cecf7b38b5d8dc312a29 Mon Sep 17 00:00:00 2001 From: ak Date: Wed, 29 Nov 2023 18:40:16 -0800 Subject: [PATCH] added duplicate items check on POST --- flask/backend.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flask/backend.py b/flask/backend.py index 31b318d..444174e 100644 --- a/flask/backend.py +++ b/flask/backend.py @@ -197,9 +197,9 @@ def post(): stores = fetchStores() if not stores: abort(404) store = stores[0] - ### - ### HERE WE NEED TO CHECK IF ITEM ALREADY EXISTS - ### + # check for existence of duplicate item + found = fetchItems(store) + if (found): abort(409) # let's create the record item = { 'name': request.args['itemName'],