Skip to content

Commit

Permalink
Finalize two projection's cleanup for riddlc 0.24.0
Browse files Browse the repository at this point in the history
  • Loading branch information
reid-spencer committed Sep 15, 2023
1 parent 930bf4d commit f9725a4
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,31 @@ context MembersAttendingEventsForAnOrganizationProjection is {
}
handler MembersAttendingEventsForAnOrganizationEventsViewHandler is {
on event MemberContext.MemberRegistered {
then "create rows in member table with attendingMember set to MemberRegistered.id"
and "set previous row's attendingMemberName to concatenated MemberRegistered.info.firstName and MemberRegistered.info.lastName"
"create rows in member table with attendingMember set to MemberRegistered.id"
"set previous row's attendingMemberName to concatenated MemberRegistered.info.firstName and MemberRegistered.info.lastName"
}
on event EventScheduled {
then "create row in event table with event set to EventScheduled.eventId, eventName set to EventScheduled.info.eventName, eventOrg to EventScheduled.info.sponsoringOrg, eventDate to day of EventScheduled.info.expectedStart"
and "create row in org-event table with event set to EventScheduled.eventId, eventOrg set to set to EventScheduled.info.sponsoringOrg"
"create row in event table with event set to EventScheduled.eventId, eventName set to EventScheduled.info.eventName, eventOrg to EventScheduled.info.sponsoringOrg, eventDate to day of EventScheduled.info.expectedStart"
"create row in org-event table with event set to EventScheduled.eventId, eventOrg set to set to EventScheduled.info.sponsoringOrg"
}
on event EventRescheduled {
then "update eventDate with day of EventRescheduled.startTime in row in event table with event corresponding to EventRescheduled.eventId"
"update eventDate with day of EventRescheduled.startTime in row in event table with event corresponding to EventRescheduled.eventId"
}
on event EventCancelled {
then "remove row in row in event table with event corresponding to EventCancelled.eventId"
and "remove row in org-event table with event set to EventScheduled.eventId, eventOrg set to set to EventScheduled.info.sponsoringOrg"
"remove row in row in event table with event corresponding to EventCancelled.eventId"
"remove row in org-event table with event set to EventScheduled.eventId, eventOrg set to set to EventScheduled.info.sponsoringOrg"
}
on event ProductCreated {
then "if product is ticket, create row in ticket-event table with sku as ticketSku & productDetails.eventId as event"
"if product is ticket, create row in ticket-event table with sku as ticketSku & productDetails.eventId as event"
}
on event OrderCreated {
then "for each OrderCreated.orderInfo.lineItem that has a SKU in ticket table, create row in ticket-event table with OrderCreated.meta.memberId as attendingMember & sku as ticketSku"
"for each OrderCreated.orderInfo.lineItem that has a SKU in ticket table, create row in ticket-event table with OrderCreated.meta.memberId as attendingMember & sku as ticketSku"
}
on query FindMembersAtEventsOnDayForOrg {
then "filter org table by FindMembersAtEventsOnDayForOrg.org"
and "left results of previous operation with org-event, ticket-event, ticket-member, member, event tables"
and "filter result of previous operation by eventDate equals FindMembersAtEventsOnDayForOrg.eventDate"
and "return MembersAtEventsOnDay with event info keyed by members - or NoEventsOnDayForOrg if table is empty"
"filter org table by FindMembersAtEventsOnDayForOrg.org"
"left results of previous operation with org-event, ticket-event, ticket-member, member, event tables"
"filter result of previous operation by eventDate equals FindMembersAtEventsOnDayForOrg.eventDate"
"return MembersAtEventsOnDay with event info keyed by members - or NoEventsOnDayForOrg if table is empty"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ context OrganizationsForMembersAttendingEventsProjections is {
}
handler OrganizationsForMembersAttendingEventsViewHandler is {
on event OrganizationEstablished {
then "create row in org table with orgId set to OrganizationEstablished.info.orgId"
and "set row's attendingMemberOrgName to OrganizationEstablished.info.name"
"create row in org table with orgId set to OrganizationEstablished.info.orgId"
"set row's attendingMemberOrgName to OrganizationEstablished.info.name"
}
on event OrganizationTerminated {
then "remove row from table"
"remove row from table"
}
on event MemberContext.MemberRegistered {
then "create rows in member table with attendingMember set to MemberRegistered.id"
and "set previous row's attendingMemberName to concatenated MemberRegistered.info.firstName and MemberRegistered.info.lastName"
and "create row in org-member table with attendingMemberOrgId set to MemberRegistered.info.organizationMembership.head"
and "set attendingMemberId to MemberRegistered.memberId"
"create rows in member table with attendingMember set to MemberRegistered.id"
"set previous row's attendingMemberName to concatenated MemberRegistered.info.firstName and MemberRegistered.info.lastName"
"create row in org-member table with attendingMemberOrgId set to MemberRegistered.info.organizationMembership.head"
"set attendingMemberId to MemberRegistered.memberId"
}
//on event MembersAddedToOrganization {
// then "create rows in org-member table with attendingMemberOrg set to MembersAddedToOrganization.orgId and attendingMembers set to MembersAddedToOrganization.newMembers"
Expand All @@ -36,39 +36,39 @@ context OrganizationsForMembersAttendingEventsProjections is {
// then "remove rows in org-member table with attendingMemberOrg set to MembersRemovedFromOrganization.orgId and attendingMembers set to MembersRemovedFromOrganization.newMembers"
//}
on event EventScheduled {
then "create row in event table with event id set to to EventScheduled.eventId"
and "set event_name to EventScheduled.info.eventName"
"create row in event table with event id set to to EventScheduled.eventId"
"set event_name to EventScheduled.info.eventName"
}
//on event EventCancelled {
// then "remove row in event table with event corresponding to EventCancelled.eventId"
//}
on event ProductCreated {
then "if product is ticket, create row in ticket-event table with sku as ticketSku & productDetails.eventId as event"
"if product is ticket, create row in ticket-event table with sku as ticketSku & productDetails.eventId as event"
}
on event ProductActivated {
then "update row in ticket-event table with the Active status"
"update row in ticket-event table with the Active status"
}
on event ProductInactivated {
then "update row in ticket-event table with the Inactive status"
"update row in ticket-event table with the Inactive status"
}
on event ProductDeleted {
then "remove row in ticket-event table"
"remove row in ticket-event table"
}
on event OrderCreated {
then "for each OrderCreated.orderInfo.lineItem that has a SKU in event-ticket table, create row in ticket-member table with OrderCreated.meta.memberId as attendingMember & sku as ticketSku"
"for each OrderCreated.orderInfo.lineItem that has a SKU in event-ticket table, create row in ticket-member table with OrderCreated.meta.memberId as attendingMember & sku as ticketSku"
}
on event LineItemOrdered {
then "create row in ticket-member table with ticketSku set to LineItemOrdered.productId"
and "set attendingMemberId to LineItemOrdered.forMemberId"
and "set orderId to LineItemOrdered.orderId"
"create row in ticket-member table with ticketSku set to LineItemOrdered.productId"
"set attendingMemberId to LineItemOrdered.forMemberId"
"set orderId to LineItemOrdered.orderId"
}
on event LineItemCancelled {
then "remove row in ticket-member table"
"remove row in ticket-member table"
}
on query FindOrgsByMembersForEvents {
then "left join event table filtered by FindOrgsByMembersForEvents.events to ticket-event table"
and "left join table found in previous operation to ticket-member, org-member, org, member tables"
and "return OrgsByMembersForEvents containing results in the form of events keyed by members keyed by orgs"
"left join event table filtered by FindOrgsByMembersForEvents.events to ticket-event table"
"left join table found in previous operation to ticket-member, org-member, org, member tables"
"return OrgsByMembersForEvents containing results in the form of events keyed by members keyed by orgs"
}
}
}
Expand Down

0 comments on commit f9725a4

Please sign in to comment.