File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -219,7 +219,30 @@ def search_gted(**kwargs: str) -> List[Dict[str, Any]]:
219219 )
220220 buzzapi_response .raise_for_status ()
221221
222- # TODO store results in Crosswalk # pylint: disable=fixme
222+ for account in buzzapi_response .json ()["api_result_data" ]:
223+ db ().execute (
224+ (
225+ "INSERT INTO crosswalk (gt_person_directory_id, gtid, primary_username)"
226+ " VALUES (:gt_person_directory_id, :gtid, :primary_username) ON CONFLICT DO NOTHING" # noqa
227+ ),
228+ {
229+ "gt_person_directory_id" : account ["gtPersonDirectoryId" ],
230+ "gtid" : account ["gtGTID" ],
231+ "primary_username" : account ["gtPrimaryGTAccountUsername" ],
232+ },
233+ )
234+ db ().execute (
235+ (
236+ "INSERT INTO crosswalk_email_address (email_address, gt_person_directory_id)" # noqa
237+ " VALUES (:email_address, :gt_person_directory_id)"
238+ " ON CONFLICT DO UPDATE SET gt_person_directory_id = (:gt_person_directory_id) WHERE email_address = (:email_address)"
239+ # noqa
240+ ),
241+ {
242+ "email_address" : account ["mail" ],
243+ "gt_person_directory_id" : account ["gtPersonDirectoryId" ],
244+ },
245+ )
223246
224247 return buzzapi_response .json ()["api_result_data" ] # type: ignore
225248
You can’t perform that action at this time.
0 commit comments