Added some unique checks so only 1 record can be made per card

This commit is contained in:
ben
2022-08-29 15:37:31 +01:00
parent 7ea3830fed
commit 33f9ae9f66
3 changed files with 59 additions and 227 deletions
+5 -1
View File
@@ -74,7 +74,11 @@ async def api_card_create_or_update(
raise HTTPException(
detail="Invalid byte data provided.", status_code=HTTPStatus.BAD_REQUEST
)
checkUid = await get_card_by_uid(data.uid)
if checkUid:
raise HTTPException(
detail="UID already registered. Delete registered card and try again.", status_code=HTTPStatus.BAD_REQUEST
)
if card_id:
card = await get_card(card_id)
if not card: