@@ -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