Skip to content

Commit b34c760

Browse files
committed
hide inactive tickets/merch from scanners
1 parent cefd925 commit b34c760

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/routes/tickets.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,16 @@ const ticketsPlugin: FastifyPluginAsync = async (fastify, _options) => {
131131
ProjectionExpression:
132132
"item_id, item_name, item_sales_active_utc, item_price",
133133
});
134+
const isTicketingManager = await fastify.authorize(request, reply, [
135+
AppRoles.TICKETS_MANAGER,
136+
]);
134137
const merchItems: ItemMetadata[] = [];
135138
const response = await dynamoClient.send(merchCommand);
136139
if (response.Items) {
137140
for (const item of response.Items.map((x) => unmarshall(x))) {
141+
if (!isTicketingManager && item.item_sales_active_utc === -1) {
142+
continue;
143+
}
138144
const memberPrice = parseInt(item.item_price?.paid, 10) || 0;
139145
const nonMemberPrice = parseInt(item.item_price?.others, 10) || 0;
140146
merchItems.push({
@@ -160,6 +166,9 @@ const ticketsPlugin: FastifyPluginAsync = async (fastify, _options) => {
160166
const ticketResponse = await dynamoClient.send(ticketCommand);
161167
if (ticketResponse.Items) {
162168
for (const item of ticketResponse.Items.map((x) => unmarshall(x))) {
169+
if (!isTicketingManager && item.event_sales_active_utc === -1) {
170+
continue;
171+
}
163172
const memberPrice = parseInt(item.eventCost?.paid, 10) || 0;
164173
const nonMemberPrice = parseInt(item.eventCost?.others, 10) || 0;
165174
ticketItems.push({

0 commit comments

Comments
 (0)