From fddb516563d642b47d3e236a5647764c137c1a05 Mon Sep 17 00:00:00 2001 From: John McCann Cunniff Jr Date: Wed, 17 Apr 2024 11:40:21 -0400 Subject: [PATCH] ADD chekc to super student add --- api/anubis/views/super/students.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/api/anubis/views/super/students.py b/api/anubis/views/super/students.py index 44869113..36cac392 100644 --- a/api/anubis/views/super/students.py +++ b/api/anubis/views/super/students.py @@ -164,11 +164,19 @@ def super_students_add(netid: str, name: str): :return: """ + user = User.query.filter(User.netid == netid.strip()).first() + if user is not None: + return success_response({ + "status": f"Student already exists {netid}", + "user": user.data, + }) + user = User(netid=netid.strip(), name=name.strip()) db.session.add(user) db.session.commit() return success_response({ - "status": f"Added student {netid}" + "status": f"Added student {netid}", + "user": user.data, })