Skip to content

Commit

Permalink
picked/unpicked event logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jlarsson committed Aug 26, 2024
1 parent 8295baa commit d01b814
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/events/eventlogging-notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ export const createEventLoggingNotifications = (
advertWasReturnedOwner: async () => undefined,
advertWaitlistAvailable: async () => undefined,
advertWasPicked: async () => undefined,
advertWasPickedOwner: async () => undefined,
advertWasUnpickedOwner: async () => undefined,
advertWasPickedOwner: (to, by, advert) =>
log('advert-was-picked', { by, advert }),
advertWasUnpickedOwner: (to, by, advert) =>
log('advert-was-unpicked', { by, advert }),
advertCollectWasRenewed: (to, by, quantity, advert) =>
log('advert-collect-was-renewed', { by, quantity, advert }),
advertCollectWasRenewedOwner: async () => undefined,
Expand Down
3 changes: 2 additions & 1 deletion src/events/mongo-event-log/mongo-event-log-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ export const createMongoEventLogService = ({
event,
})
},
getEvents: async ({ from, to }) => {
getEvents: async ({ from, to, advertId }) => {
const collection = await getCollection()
const cursor = collection.find({
$and: [
from && { 'event.at': { $gte: from.toISOString() } },
to && { 'event.at': { $lte: to.toISOString() } },
advertId && { 'event.advertId': advertId },
].filter(v => v),
} as Filter<MongoEvent>)

Expand Down

0 comments on commit d01b814

Please sign in to comment.