22from fastapi .responses import JSONResponse
33
44import database
5- import elections
6- import elections .crud
5+ import nominees .crud
76from elections .models import (
87 NomineeInfoModel ,
98 NomineeInfoUpdateParams ,
@@ -32,7 +31,7 @@ async def get_nominee_info(
3231):
3332 # Putting this one behind the admin wall since it has contact information
3433 await admin_or_raise (request , db_session )
35- nominee_info = await elections .crud .get_nominee_info (db_session , computing_id )
34+ nominee_info = await nominees .crud .get_nominee_info (db_session , computing_id )
3635 if nominee_info is None :
3736 raise HTTPException (
3837 status_code = status .HTTP_404_NOT_FOUND ,
@@ -72,13 +71,13 @@ async def provide_nominee_info(
7271 if body .discord_username is not None :
7372 updated_data ["discord_username" ] = body .discord_username
7473
75- existing_info = await elections .crud .get_nominee_info (db_session , computing_id )
74+ existing_info = await nominees .crud .get_nominee_info (db_session , computing_id )
7675 # if not already existing, create it
7776 if not existing_info :
7877 # unpack dictionary and expand into NomineeInfo class
7978 new_nominee_info = NomineeInfo (computing_id = computing_id , ** updated_data )
8079 # create a new nominee
81- await elections .crud .create_nominee_info (db_session , new_nominee_info )
80+ await nominees .crud .create_nominee_info (db_session , new_nominee_info )
8281 # else just update the partial data
8382 else :
8483 merged_data = {
@@ -92,11 +91,11 @@ async def provide_nominee_info(
9291 # update the dictionary with new data
9392 merged_data .update (updated_data )
9493 updated_nominee_info = NomineeInfo (** merged_data )
95- await elections .crud .update_nominee_info (db_session , updated_nominee_info )
94+ await nominees .crud .update_nominee_info (db_session , updated_nominee_info )
9695
9796 await db_session .commit ()
9897
99- nominee_info = await elections .crud .get_nominee_info (db_session , computing_id )
98+ nominee_info = await nominees .crud .get_nominee_info (db_session , computing_id )
10099 if not nominee_info :
101100 raise HTTPException (
102101 status_code = status .HTTP_500_INTERNAL_SERVER_ERROR ,
0 commit comments