Skip to content

Commit 0c48705

Browse files
committed
fix the merch route
1 parent f48451c commit 0c48705

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/routes/tickets.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ const ticketsPlugin: FastifyPluginAsync = async (fastify, _options) => {
8181
stripe_pi: { S: ticketId },
8282
},
8383
UpdateExpression: "SET fulfilled = :true_val",
84-
ConditionExpression: "#email = :email_val", // Added # to reference the attribute name
84+
ConditionExpression: "#email = :email_val",
8585
ExpressionAttributeNames: {
86-
"#email": "email", // Define the attribute name
86+
"#email": "email",
8787
},
8888
ExpressionAttributeValues: {
8989
":true_val": { BOOL: true },
@@ -126,7 +126,7 @@ const ticketsPlugin: FastifyPluginAsync = async (fastify, _options) => {
126126
message: "Ticket was already refunded.",
127127
});
128128
}
129-
if (attributes["used"]) {
129+
if (attributes["used"] || attributes["fulfilled"]) {
130130
throw new TicketNotValidError({
131131
message: "Ticket has already been used.",
132132
});
@@ -182,6 +182,7 @@ const ticketsPlugin: FastifyPluginAsync = async (fastify, _options) => {
182182
ConditionExpression: "email = :email_val",
183183
ExpressionAttributeValues: {
184184
":scanner_email": { S: request.username },
185+
":email_val": { S: request.body.email },
185186
},
186187
});
187188
break;

0 commit comments

Comments
 (0)