@@ -22,7 +22,7 @@ import {
2222 withRoles ,
2323 withTags ,
2424} from "api/components/index.js" ;
25- import { verifyUiucAccessToken , saveHashedUserUin } from "api/functions/uin.js" ;
25+ import { verifyUiucAccessToken , getHashedUserUin } from "api/functions/uin.js" ;
2626import { getKey , setKey } from "api/functions/redisCache.js" ;
2727import { getEntraIdToken } from "api/functions/entraId.js" ;
2828import { genericConfig , roleArns } from "common/config.js" ;
@@ -31,6 +31,7 @@ import { SecretsManagerClient } from "@aws-sdk/client-secrets-manager";
3131import { BatchGetItemCommand , DynamoDBClient } from "@aws-sdk/client-dynamodb" ;
3232import { AppRoles } from "common/roles.js" ;
3333import { marshall , unmarshall } from "@aws-sdk/util-dynamodb" ;
34+ import { syncFullProfile } from "api/functions/sync.js" ;
3435
3536const membershipV2Plugin : FastifyPluginAsync = async ( fastify , _options ) => {
3637 const getAuthorizedClients = async ( ) => {
@@ -115,11 +116,16 @@ const membershipV2Plugin: FastifyPluginAsync = async (fastify, _options) => {
115116 } ) ;
116117 }
117118 request . log . debug ( "Saving user hashed UIN!" ) ;
118- const saveHashPromise = saveHashedUserUin ( {
119+ const uinHash = await getHashedUserUin ( {
119120 uiucAccessToken : accessToken ,
120121 pepper : fastify . secretConfig . UIN_HASHING_SECRET_PEPPER ,
121- dynamoClient : fastify . dynamoClient ,
122+ } ) ;
123+ const savePromise = syncFullProfile ( {
124+ uinHash,
125+ firstName : givenName ,
126+ lastName : surname ,
122127 netId,
128+ dynamoClient : fastify . dynamoClient ,
123129 } ) ;
124130 let isPaidMember = await checkPaidMembershipFromRedis (
125131 netId ,
@@ -132,7 +138,7 @@ const membershipV2Plugin: FastifyPluginAsync = async (fastify, _options) => {
132138 fastify . dynamoClient ,
133139 ) ;
134140 }
135- await saveHashPromise ;
141+ await savePromise ;
136142 request . log . debug ( "Saved user hashed UIN!" ) ;
137143 if ( isPaidMember ) {
138144 throw new ValidationError ( {
0 commit comments