Skip to content

Commit

Permalink
Merge pull request #434 from ubc-biztech/profiles-v1
Browse files Browse the repository at this point in the history
Add description "I am", Partner profile type, and update registration
  • Loading branch information
voctory authored Jan 18, 2025
2 parents 9077115 + 3be09d2 commit fcf09c7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
26 changes: 23 additions & 3 deletions services/profiles/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const createProfile = async (event, ctx, callback) => {
fname: registration.basicInformation.fname,
lname: registration.basicInformation.lname,
pronouns: registration.basicInformation.gender && registration.basicInformation.gender.length ? registration.basicInformation.gender[0] : "",
type: "Attendee",
type: registration.isPartner ? "Partner" : "Attendee",
major: registration.basicInformation.major,
year: registration.basicInformation.year,
hobby1: registration.dynamicResponses["130fac25-e5d7-4fd1-8fd8-d844bfdaef06"] || "",
Expand All @@ -61,6 +61,7 @@ export const createProfile = async (event, ctx, callback) => {
linkedIn: registration.dynamicResponses["ffcb7fcf-6a24-46a3-bfca-e3dc96b6309f"] || "",
profilePictureURL: registration.dynamicResponses["1fb1696d-9d90-4e02-9612-3eb9933e6c45"] || "",
additionalLink: registration.dynamicResponses["e164e119-6d47-453b-b215-91837b70e9b7"] || "",
description: registration.dynamicResponses["6849bb7f-b8bd-438c-b03b-e046cede378a"] || "",
createdAt: timestamp,
updatedAt: timestamp
};
Expand All @@ -76,10 +77,28 @@ export const createProfile = async (event, ctx, callback) => {
}
};

// Create both profile and NFC entries
const params = {
Key: {
id: email,
"eventID;year": eventIDAndYear
},
TableName: REGISTRATIONS_TABLE + (process.env.ENVIRONMENT || ""),
UpdateExpression: "set profileID = :profileID, updatedAt = :updatedAt",
ExpressionAttributeValues: {
":profileID": profileID,
":updatedAt": timestamp
},
ReturnValues: "UPDATED_NEW",
ConditionExpression: "attribute_exists(id) and attribute_exists(#eventIDYear)",
ExpressionAttributeNames: {
"#eventIDYear": "eventID;year"
}
};

await Promise.all([
db.create(profile, PROFILES_TABLE),
db.create(nfc, QRS_TABLE)
db.create(nfc, QRS_TABLE),
db.updateDBCustom(params)
]);

const response = helpers.createResponse(201, {
Expand Down Expand Up @@ -112,6 +131,7 @@ const filterPublicProfileFields = (profile) => ({
linkedIn: profile.linkedIn,
profilePictureURL: profile.profilePictureURL,
additionalLink: profile.additionalLink,
description: profile.description,
"eventID;year": profile["eventID;year"],
createdAt: profile.createdAt,
updatedAt: profile.updatedAt
Expand Down
1 change: 1 addition & 0 deletions services/profiles/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ provider:
Action:
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:Query
Resource:
- "arn:aws:dynamodb:${aws:region}:*:table/biztechProfiles${self:provider.environment.ENVIRONMENT}"
Expand Down

0 comments on commit fcf09c7

Please sign in to comment.