diff --git a/build.sbt b/build.sbt index d620dde71..f296dd2ed 100644 --- a/build.sbt +++ b/build.sbt @@ -1,6 +1,6 @@ Global / onChangedBuildSource := ReloadOnSourceChanges scalaVersion := "3.3.1" -lazy val riddl_version = "0.24.5" +lazy val riddl_version = "0.39.0" libraryDependencies ++= Seq( "com.reactific" %% "riddl-testkit" % riddl_version % "test", "com.reactific" %% "riddl-hugo" % riddl_version % "test", @@ -10,7 +10,7 @@ libraryDependencies ++= Seq( enablePlugins(RiddlSbtPlugin) riddlcOptions := Seq("--show-times", "from", "src/main/riddl/ImprovingApp.conf", "hugo") -riddlcMinVersion := "0.24.6" +riddlcMinVersion := s"${riddl_version}" riddlcPath := file( // NOTE: Set this to your local path which will always have this portion // NOTE: of the path as a constant: riddl/riddlc/target/universal/stage/bin/riddlc diff --git a/src/main/riddl/AllIdsProjections/allIdsProjections.riddl b/src/main/riddl/AllIdsProjections/allIdsProjections.riddl index 4de512e14..a0065d6a0 100644 --- a/src/main/riddl/AllIdsProjections/allIdsProjections.riddl +++ b/src/main/riddl/AllIdsProjections/allIdsProjections.riddl @@ -1,21 +1,22 @@ //all comments to be implemented post kalix-study +//all comments to be implemented post kalix-study -query GetAllTenantIds is {} +query GetAllTenantIds is { ??? } result AllTenantIds is {tenants: TenantId*} -query GetAllOrgIds is {} +query GetAllOrgIds is { ??? } result AllOrgIds is {orgs: OrganizationId*} -query GetAllEventIds is {} +query GetAllEventIds is { ??? } result AllEventIds {events: EventId*} -query GetAllMemberIds is {} +query GetAllMemberIds is { ??? } result AllMemberIds is {members: MemberId*} -query GetAllStoreIds is {} -result AllStoreIds is {stores: StoreId*} +query GetAllStoreIds is { ??? } +result AllStoreIds is {stores: StoreContext.StoreId*} -query GetAllSkus is {} +query GetAllSkus is { ??? } result AllSkus is {skus: SKU*} context AllIdsProjections is { @@ -25,8 +26,9 @@ context AllIdsProjections is { //tenantStatus: TenantContext.Status } handler AllTenantIdsViewHandler is { + on event TenantEstablished { - "create row with tenant set to TenantEstablished.tenantId"// and tenantStatus to Draft" + "create row with tenant set to TenantEstablished.tenantId and tenantStatus to Draft" } //on event TenantContext.StatusUpdated { // then "update row with tenant set to StatusUpdated.tenantId to tenantStatus with StatusUpdated.newStatus" @@ -43,7 +45,7 @@ context AllIdsProjections is { //orgStatus: OrganizationContext.Status } handler AllOrgIdsViewHandler is { - on event OrganizationEstablished { + on event ImprovingApp.OrganizationContext.OrganizationEstablished { "create row with org set to OrganizationEstablished.orgId"// and orgStatus set to Draft" } //on event OrganizationStatusUpdated { @@ -88,7 +90,7 @@ context AllIdsProjections is { projector AllMemberIdsView is { record AllMemberIdsFields { member: MemberId, - memberStatus: MemberContext.Status + memberStatus: MemberContext.MemberStates } handler AllMemberIdsViewHandler is { on event MemberContext.MemberRegistered { @@ -105,7 +107,7 @@ context AllIdsProjections is { projector AllStoreIdsView is { record AllStoreIdsFields { - store: StoreId + store: StoreContext.StoreId } handler AllStoreIdsViewHandler is { on event StoreCreated { diff --git a/src/main/riddl/Applications/application.riddl b/src/main/riddl/Applications/application.riddl index b242763d7..77925a6af 100644 --- a/src/main/riddl/Applications/application.riddl +++ b/src/main/riddl/Applications/application.riddl @@ -2,7 +2,7 @@ application UserInterface is { command EstablishOrganization is { info: MemberContext.EditableInfo briefly "Details about an organization required for it to exist. See OrganizationContext.Organization.Info for details.", tenant: TenantId, - parent: Parent?, + parent: OrganizationContext.Parent?, members: MemberList, owners: OwnerList, contacts: ContactList, @@ -12,29 +12,27 @@ application UserInterface is { result OrganizationEstablished is { organizationId: OrganizationId briefly "Unique identifier returned by EstablishOrganization command", info: OrganizationContext.Info, - parent: Parent?, + parent: OrganizationContext.Parent?, members: MemberList, owners: OwnerList, contacts: ContactList, meta: OrganizationContext.MetaInfo } + command CreateOrganization { ??? } // FIXME: needs to be completed group Organization is { - input EstablishOrganization is { - acquires command UserInterface.EstablishOrganization - } - output DisplayOrganization is { - presents result OrganizationEstablished - } + input EstablishOrganization acquires command UserInterface.EstablishOrganization + + output DisplayOrganization presents result UserInterface.OrganizationEstablished } handler OrgHandler is { - on command EstablishOrganization from user OrgOwner { - tell command UserInterface.CreateOrganization to context ImprovingApp.OrganizationContext + on command OrganizationContext.EstablishOrganization from user OrgOwner { + tell command OrganizationContext.OrganizationEstablished to context OrganizationContext } - on event OrganizationEstablished from context ImprovingApp.OrganizationContext { - tell result ImprovingApp.OrganizationContext.OrganizationEstablished to - projector ImprovingApp.OrganizationContext.OrganizationViews + on event OrganizationContext.OrganizationEstablished from context OrganizationContext { + //tell resultOrganizationContext.OrganizationEstablished to + // projector Relationships.OrganizationViews } } @@ -50,52 +48,43 @@ application UserInterface is { } group Member is { - input RegisterMember is { - acquires command UserInterface.RegisterMember - } - output DisplayMemberDetails is { - presents result MemberRegistered - } + input RegisterMember acquires command UserInterface.RegisterMember + output DisplayMemberDetails presents result ImprovingApp.UserInterface.MemberRegistered } handler MemberHandler is { - on command RegisterMember from user DemoMember { + on command ImprovingApp.GatewayAPI.MemberGateway.RegisterMember from user DemoMember { tell command UserInterface.RegisterMember to context ImprovingApp.MemberContext } - on event MemberRegistered from context ImprovingApp.MemberContext { - tell result ImprovingApp.MemberContext.MemberRegistered to - projector ImprovingApp.MemberContext.MemberViews + on event ImprovingApp.GatewayAPI.MemberGateway.MemberRegistered from context ImprovingApp.MemberContext { + //tell result ImprovingApp.MemberContext.MemberRegistered to + // projector ImprovingApp.MemberContext.MemberViews } } command PurchaseProduct is { productSku: ProductContext.SKU } - type ProductPurchased is { + event ProductPurchased is { productSku: ProductContext.SKU, productInfo: ProductContext.ProductInfo, productMeta: ProductContext.ProductMetaInfo } result ProductsPurchased is { - products: ProductPurchased* + products: ProductContext.SKU* } group Product is { - input PurchaseProduct is { - acquires command UserInterface.PurchaseProduct - } - output DisplayPurchases is { - presents result ProductsPurchased - } + input PurchaseProduct acquires command UserInterface.PurchaseProduct + output DisplayPurchases presents result ProductsPurchased } handler ProductHandler is { - on command PurchaseProduct from user Member { - tell command PurchaseProduct to context ProductContext + on command ImprovingApp.GatewayAPI.DemoScenarioGateway.PurchaseProduct from user ImprovingApp.GatewayAPI.Member { + tell command ImprovingApp.UserInterface.PurchaseProduct to context ProductContext } - on event ProductContext.ProductPurchased - from context ProductContext { - tell result ProductContext.ProductCreated to projector ProductContext.ProductViews + on event ImprovingApp.UserInterface.ProductPurchased from context ProductContext { + //tell result ProductContext.ProductCreated to projector ProductContext.ProductViews } } } @@ -109,19 +98,15 @@ application CommandLine is { } group Scenario is { - input StartScenario is { - acquires command CommandLine.StartScenario - } - output DisplayScenario is { - presents result CommandLine.ScenarioStarted - } + input StartScenario acquires command CommandLine.StartScenario + output DisplayScenario presents result CommandLine.ScenarioStarted } handler CurlHandler is { - on command StartScenario from user Member { - tell command CommandLine.StartScenario to context GatewayContext + on command ImprovingApp.CommandLine.StartScenario from user ImprovingApp.GatewayAPI.Member { + tell command CommandLine.StartScenario to context GatewayAction } - on event ScenarioStarted from context ImprovingApp.GatewayContext { + on result ImprovingApp.CommandLine.ScenarioStarted from context GatewayAction { "display in terminal" } } diff --git a/src/main/riddl/Calendars/calendar.riddl b/src/main/riddl/Calendars/calendar.riddl index eb364e319..481004d7e 100644 --- a/src/main/riddl/Calendars/calendar.riddl +++ b/src/main/riddl/Calendars/calendar.riddl @@ -1,7 +1,9 @@ context Calendars is { - //Thinking of "outsourcing" this feature to google calendar. As such, this domain is an integration - //to the 3rd party app. It would be a good chance to teach the focuser pattern. There might also be - //some light customization (TBD). - //The google calendar API can be found here: https://developers.google.com/calendar/api - ??? + ??? } + +//Thinking of "outsourcing" this feature to google calendar. As such, this domain is an integration +//to the 3rd party app. It would be a good chance to teach the focuser pattern. There might also be +//some light customization (TBD). +//The google calendar API can be found here: https://developers.google.com/calendar/api + diff --git a/src/main/riddl/Commerce/commerce.riddl b/src/main/riddl/Commerce/commerce.riddl index 1c0a7b5a6..269c83cd0 100644 --- a/src/main/riddl/Commerce/commerce.riddl +++ b/src/main/riddl/Commerce/commerce.riddl @@ -7,20 +7,20 @@ context Commerce is { condition: String, action: String } - type PaymentId is Id( Payment ) + type PaymentId is Id( Commerce.Payment ) type DeliveryId is Id( Delivery ) type DeliveryInfo is { orderId: OrderId, - location: LocationId, + location: Venues.LocationId, specialInstructions: String } //not part of MVP type NullState is Nothing entity Promotion is { - state Active of ^^NullState is {???} + state Active of Commerce.NullState is {???} handler ActivePromotionHandler is {???} - state Expired of ^^NullState is {???} + state Expired of Commerce.NullState is {???} handler InactivePromotionHandler is {???} } //not part of MVP @@ -33,20 +33,20 @@ context Commerce is { amount: Number, dateProcessed: DateTime } - state Payment of ^PaymentState is { + state Payment of PaymentState is { handler PaymentHandler is {???} } } entity Cart is {???} //develop as a future feature - Persistant Cart - Training exercise entity Delivery is { - state Pending of ^^NullState is {???} + state Pending of Commerce.NullState is {???} handler PendingDeliveryHandler is {???} - state Ready of ^^NullState is {???} + state Ready of Commerce.NullState is {???} handler ReadyDeliveryHandler is {???} - state EnRoute of ^^NullState is {???} + state EnRoute of Commerce.NullState is {???} handler EnRoutDeliveryHandler is {???} - state Delivered of ^^NullState is {???} + state Delivered of Commerce.NullState is {???} handler DeliveredDeliveryHandler is {???} } //not part of MVP } diff --git a/src/main/riddl/Common/Contact.riddl b/src/main/riddl/Common/Contact.riddl index b205f9504..ee5707868 100644 --- a/src/main/riddl/Common/Contact.riddl +++ b/src/main/riddl/Common/Contact.riddl @@ -1,6 +1,4 @@ -// Copyright (c) 2022 Improving Inc. -// Types for Contact Information type MobileNumber is Pattern("\\(([0-9]{3})\\)([0-9]{3})-([0-9]{4})") briefly "North American Phone Number standard" type EmailAddress is Pattern("(?:[a-z0-9!#$%&'*+/=?^_`{|}~-](?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-])|\"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])\")@(?:(?:[a-z0-9](?:[a-z0-9-][a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-][a-z0-9])?|[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)])") @@ -11,6 +9,7 @@ type USPostalCode is Pattern("\\d{5}(-\\d{4})?") briefly "A USA Postal Code" type PostalCode is one of { CAPostalCode, USPostalCode } briefly "Either a USA or Canadian postal code" +// Types for Contact Information type Address is { line1: String, @@ -29,3 +28,4 @@ type Contact is { userName: String } briefly "Contact information for an individual" +// Copyright (c) 2022 Improving Inc. \ No newline at end of file diff --git a/src/main/riddl/Epics/epics.riddl b/src/main/riddl/Epics/epics.riddl index 1458d87cd..7484afbb2 100644 --- a/src/main/riddl/Epics/epics.riddl +++ b/src/main/riddl/Epics/epics.riddl @@ -1,12 +1,14 @@ user OrgOwner is "the person that owns the organization" user Member is "any member (user) of the system" -epic EstablishOrganization by author Reid is { - user ImprovingApp.OrgOwner wants "to establish an organization" so that - "they can conduct business as that organization" +include "memberEpics" + +epic EstablishOrganization is { + by author Reid case primary is { + user OrgOwner wants "to establish an organization" so that "they can conduct business as that organization" step from user OrgOwner "creates an Organization" to input - ImprovingApp.UserInterface.Organization.EstablishOrganization briefly "fill out form", + ImprovingApp.UserInterface.Organization.EstablishOrganization briefly "fill out form" step from output ImprovingApp.UserInterface.Organization.DisplayOrganization "organizationAdded" @@ -15,10 +17,11 @@ epic EstablishOrganization by author Reid is { } briefly "A story about establishing an organization in Improving.app" described as "This is the story of how an organization comes to existence" -epic RegisterMemberToOrganization by author Reid is { - user ImprovingApp.OrgOwner wants "to register a member" so that - "they can fill the roster for their organization" - case primary is { ??? } +epic RegisterMemberToOrganization is { + by author Reid + case primary is { + //user OrgOwner wants "to register a member" so that "they can fill the roster for their organization" + } } briefly "A story about registering a member into an organization" described as "TBD" diff --git a/src/main/riddl/Gateway/MemberGateway/memberEpics.riddl b/src/main/riddl/Epics/memberEpics.riddl similarity index 99% rename from src/main/riddl/Gateway/MemberGateway/memberEpics.riddl rename to src/main/riddl/Epics/memberEpics.riddl index 1ba375e08..1fed4a263 100644 --- a/src/main/riddl/Gateway/MemberGateway/memberEpics.riddl +++ b/src/main/riddl/Epics/memberEpics.riddl @@ -1,14 +1,15 @@ -// TODO: convert every Feature to an epic and every Scenario to a case -// Note: this will involve creating components for application UserInterface for each epic - -epic RegisterMember by author Alex is { +epic RegisterMember is { user Member wants "to register as a member" so that "they can perform functions in the app" + by author Alex term 'member' described as { | An entity that is allowed to do queries on other entities or actions on other entities. | Much of their behaviour will be constrained or permitted be based on ownership, membership, & | permissions in the future. } } +// TODO: convert every Feature to an epic and every Scenario to a case +// Note: this will involve creating components for application UserInterface for each epic + // case RegisterActiveMember is { // step from user Member "register as a member" to input // Then the new registration is validated for handle and member id (make sure they are unique in the system( diff --git a/src/main/riddl/Events/Reservations/reservation.riddl b/src/main/riddl/Events/Reservations/reservation.riddl index da795a75c..0c3ba60ec 100644 --- a/src/main/riddl/Events/Reservations/reservation.riddl +++ b/src/main/riddl/Events/Reservations/reservation.riddl @@ -5,18 +5,21 @@ context ReservationContext is { include "reservationTypeDefinitions" include "reservationMessages" + // TODO: List the names of the public reservation events here type PublicReservationEvent is one of { - // TODO: List the names of the public reservation events here + ??? } outlet Events is type PublicReservationEvent entity Reservation is { - options (event-sourced, available) + option event-sourced + option available handler ReservationHandler is { on command EstablishReservation { - morph entity Reservation to state Draft with record DraftState + morph entity Reservation to state ImprovingApp.Events.ReservationContext.Reservation.Draft with + record ImprovingApp.Events.ReservationContext.Reservation.DraftState "Copy fields from the command into Draft fields" "adjust meta fields to reflect the change set" send event ReservationEstablished to outlet ReservationContext.Events @@ -33,14 +36,14 @@ context ReservationContext is { } state Draft of Reservation.DraftState is { handler DraftReservation is { - on command EstablishReservation { + on command ImprovingApp.Events.ReservationContext.EstablishReservation { error "Reservation already established" } - on command EditReservationInfo { - set field Draft.info to "EditReservationInfo.info" + on command ImprovingApp.Events.ReservationContext.EditReservationInfo { + set field ImprovingApp.Events.ReservationContext.Reservation.Draft.reservationInfo to "EditReservationInfo.info" send event ReservationInfoUpdated to outlet ReservationContext.Events } - on command UpdateReservationStatus { + on command ImprovingApp.Events.ReservationContext.UpdateReservationStatus { "morph entity Reservation to state provided in UpdateReservationStatus" "set MetaInfo to capture change data" "yield event ReservationStatusUpdated" @@ -54,14 +57,14 @@ context ReservationContext is { } state OnHold of Reservation.OnHoldState is { handler OnHoldReservation is { - on command EstablishReservation { + on command ImprovingApp.Events.ReservationContext.EstablishReservation { error "Reservation already established" } - on command EditReservationInfo { + on command ImprovingApp.Events.ReservationContext.EditReservationInfo { "set OnHold info fields to EditReservationInfo.info" "yield event ReservationInfoUpdated" } - on command UpdateReservationStatus { + on command ImprovingApp.Events.ReservationContext.UpdateReservationStatus { "morph Reservation to the state provided in UpdateReservationStatus" "set MetaInfo to capture change data" "yield event ReservationStatusUpdated" @@ -75,13 +78,13 @@ context ReservationContext is { } state Reserved of Reservation.ReservedState is { handler ReservedReservation is { - on command EstablishReservation { + on command ImprovingApp.Events.ReservationContext.EstablishReservation { error "Reservation already established" } - on command EditReservationInfo { + on command ImprovingApp.Events.ReservationContext.EditReservationInfo { error "Reservation is in Reserved state, editing info not allows" } - on command UpdateReservationStatus { + on command ImprovingApp.Events.ReservationContext.UpdateReservationStatus { "morph Reservation to the state provided in UpdateReservationStatus" "set MetaInfo to capture change data" "yield event ReservationStatusUpdated" } diff --git a/src/main/riddl/Events/Reservations/reservationTypeDefinitions.riddl b/src/main/riddl/Events/Reservations/reservationTypeDefinitions.riddl index 9914365f5..9fa41fcc9 100644 --- a/src/main/riddl/Events/Reservations/reservationTypeDefinitions.riddl +++ b/src/main/riddl/Events/Reservations/reservationTypeDefinitions.riddl @@ -1,15 +1,15 @@ type Status is any of {Draft, OnHold, Reserved, Past, Cancelled} briefly "Internal status of a Reservation." type Info is { - range: TimeRange, + range: ImprovingApp.TimeRange, title: String, description: String, - location: LocationId, + location: Venues.LocationId, forOrg: OrganizationId } type UpdateInfo is { - range: TimeRange?, + range: ImprovingApp.TimeRange?, title: String?, description: String?, forOrg: OrganizationId? diff --git a/src/main/riddl/Events/eventContext.riddl b/src/main/riddl/Events/eventContext.riddl index 951274d74..97e2709a9 100644 --- a/src/main/riddl/Events/eventContext.riddl +++ b/src/main/riddl/Events/eventContext.riddl @@ -41,31 +41,8 @@ context EventContext is { handler EventHandler is { on command CreateEvent { - send event EventCreated - // ( - // eventId = @CreateEvent.eventId, - // info = @CreateEvent.info, - // meta = !EventMetaInfo( - // createdOn = now(), - // createdBy = @CreateEvent.onBehalfOf, - // lastUpdatedOn = now(), - // lastUpdatedBy = @CreateEvent.onBehalfOf, - // currentState = @EventStates.Draft - // ) - // ) - to outlet EventEvents.Events + send event EventCreated to outlet EventEvents.Events morph entity Event to state DraftEvent with record DraftEventState - // ( - // eventId = @CreateEvent.eventId, - // info = @CreateEvent.info, - // meta = !EventMetaInfo( - // createdOn = now(), - // createdBy = @CreateEvent.onBehalfOf, - // lastUpdatedOn = now(), - // lastUpdatedBy = @CreateEvent.onBehalfOf, - // currentState = @OrganizationStates.Draft - // ) - // ) } on other { error "You must first create an event using ScheduleEvent command." @@ -83,218 +60,36 @@ context EventContext is { on command ScheduleEvent{ if "all required info fields are present" then { "set a scheduled Akka call for emitting StartEvent at DraftEventState.info.expectedStart" - send event EventScheduled - // ( - // eventId = @ScheduleEvent.eventId, - // info = !EventInfo( - // eventName = @DraftEventState.info.eventName, - // description = @DraftEventState.info.description, - // eventURL = @DraftEventState.info.eventURL, - // sponsoringOrg = @DraftEventState.info.sponsoringOrg, - // expectedStart = @DraftEventState.info.expectedStart, - // expectedEnd = @DraftEventState.info.expectedEnd, - // isPrivate = @DraftEventState.info.isPrivate, - // eventStatusInfo = !ScheduledEventInfo() - // ), - // meta = !EventMetaInfo( - // createdOn = @DraftEventState.meta.createdOn, - // createdBy = @DraftEventState.meta.createdBy, - // lastUpdatedOn = now(), - // lastUpdatedBy = @ScheduleEvent.onBehalfOf, - // currentState = @EventStates.Scheduled - // ) - // ) - to outlet EventEvents.Events - morph entity Event to state ScheduledEvent - with record ScheduledEventState - // ( - // eventId = @ScheduleEvent.eventId, - // info = !EventInfo( - // eventName = @DraftEventState.info.eventName, - // description = @DraftEventState.info.description, - // eventURL = @DraftEventState.info.eventURL, - // sponsoringOrg = @DraftEventState.info.sponsoringOrg, - // expectedStart = @DraftEventState.info.expectedStart, - // expectedEnd = @DraftEventState.info.expectedEnd, - // isPrivate = @DraftEventState.info.isPrivate, - // eventStatusInfo = !ScheduledEventInfo() - // ), - // meta = !EventMetaInfo( - // createdOn = @DraftEventState.meta.createdOn, - // createdBy = @DraftEventState.meta.createdBy, - // lastUpdatedOn = now(), - // lastUpdatedBy = @ScheduleEvent.onBehalfOf, - // currentState = @EventStates.Scheduled - // ) - // ) + send event EventScheduled to outlet EventEvents.Events + morph entity Event to state ScheduledEvent with record ScheduledEventState } } on command EditEventInfo{ set field DraftEventState.info to "EventContext.newEditableInfoFromFieldsPresentInEditable" - // ( - // editable = @EditEventInfo.info, - // oldInfo = @DraftEventState.info - // ) set field DraftEventState.meta to "EventMetaInfo" -// ( -// createdOn = @DraftEventState.meta.createdOn, -// createdBy = @DraftEventState.meta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @EditEventInfo.onBehalfOf, -// currentState = @EventStates.Draft -// ) send event EventRescheduled -// ( -// eventId = @DraftEventState.id, -// info = @DraftEventState.info, -// meta = @DraftEventState.meta -// ) to outlet EventEvents.Events } on command CancelEvent{ if "all required info fields are present" then { "cancel associated scheduled call to emit StartEvent" - send event EventCancelled -// ( -// eventId = @CancelEvent.eventId, -// info = !EventInfo( -// eventName = @DraftEventState.info.eventName, -// description = @DraftEventState.info.description, -// eventURL = @DraftEventState.info.eventURL, -// sponsoringOrg = @DraftEventState.info.sponsoringOrg, -// expectedStart = @DraftEventState.info.expectedStart, -// expectedEnd = @DraftEventState.info.expectedEnd, -// isPrivate = @DraftEventState.info.isPrivate, -// eventStatusInfo = !CancelledEventInfo( -// reason = @CancelEvent.reason, -// timeStarted = startTimeIfPast(startTime = @DraftEventState.info.expectedStart), -// timeEnded = nowIfStartIsPast(startTime = @DraftEventState.info.expectedStart) -// ) -// ), -// meta = !EventMetaInfo( -// createdOn = @DraftEventState.meta.createdOn, -// createdBy = @DraftEventState.meta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @CancelEvent.onBehalfOf, -// currentState = @EventStates.Cancelled -// ) -// ) - to outlet EventEvents.Events + send event EventCancelled to outlet EventEvents.Events morph entity Event to state ScheduledEvent with record ScheduledEventState -// ( -// eventId = @ScheduleEvent.eventId, -// info = !EventInfo( -// eventName = @DraftEventState.info.eventName, -// description = @DraftEventState.info.description, -// eventURL = @DraftEventState.info.eventURL, -// sponsoringOrg = @DraftEventState.info.sponsoringOrg, -// expectedStart = @DraftEventState.info.expectedStart, -// expectedEnd = @DraftEventState.info.expectedEnd, -// isPrivate = @DraftEventState.info.isPrivate, -// eventStatusInfo = !CancelledEventInfo( -// reason = @CancelEvent.reason, -// timeStarted = startTimeIfPast(startTime = @DraftEventState.info.expectedStart), -// timeEnded = nowIfStartIsPast(startTime = @DraftEventState.info.expectedStart) -// ) -// ), -// meta = !EventMetaInfo( -// createdOn = @DraftEventState.meta.createdOn, -// createdBy = @DraftEventState.meta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @CancelEvent.onBehalfOf, -// currentState = @EventStates.Cancelled -// ) -// ) } } on command RescheduleEvent { if "start is validated to be before end in command" then { "adjust associated scheduled call to emit StartEvent" set field DraftEventState.info to "EditableEventInfo" -// ( -// eventName = @DraftEventState.info.eventName, -// description = @DraftEventState.info.description, -// eventURL = @DraftEventState.info.eventURL, -// sponsoringOrg = @DraftEventState.info.sponsoringOrg, -// expectedStart = @RescheduleEvent.start, -// expectedEnd = @RescheduleEvent.end, -// isPrivate = @DraftEventState.info.isPrivate -// ) set field DraftEventState.meta to "EventMetaInfo" -// ( -// createdOn = @DraftEventState.meta.createdOn, -// createdBy = @DraftEventState.meta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @RescheduleEvent.onBehalfOf, -// currentState = @EventStates.Draft -// ) - send event EventRescheduled -// ( -// eventId = @DraftEventState.id, -// info = @DraftEventState.info, -// meta = @DraftEventState.meta -// ) - to outlet EventEvents.Events + send event EventRescheduled to outlet EventEvents.Events } } on command DelayEvent{ if "all required info fields are present" then { "adjust associated scheduled call to emit StartEvent" - send event EventDelayed -// ( -// eventId = @DelayEvent.eventId, -// info = !EventInfo( -// eventName = @DraftEventState.info.eventName, -// description = @DraftEventState.info.description, -// eventURL = @DraftEventState.info.eventURL, -// sponsoringOrg = @DraftEventState.info.sponsoringOrg, -// expectedStart = incrementDelayedEventTime( -// originalTime = @DraftEventState.info.expectedStart, -// duration = @DelayEvent.expectedDuration -// ), -// expectedEnd = incrementDelayedEventTime( -// originalTime = @DraftEventState.info.expectedEnd, -// duration = @DelayEvent.expectedDuration -// ), -// isPrivate = @DraftEventState.info.isPrivate, -// eventStatusInfo = !DelayedEventInfo( -// reason = @DelayEvent.reason, -// timeStartedOpt = false -// ) -// ), -// meta = !EventMetaInfo( -// createdOn = @DraftEventState.meta.createdOn, -// createdBy = @DraftEventState.meta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @DelayEvent.onBehalfOf, -// currentState = @EventStates.Delayed -// ) -// ) - to outlet EventEvents.Events + send event EventDelayed to outlet EventEvents.Events morph entity Event to state ScheduledEvent with record ScheduledEventState -// ( -// eventId = @ScheduleEvent.eventId, -// info = !EventInfo( -// eventName = @DraftEventState.info.eventName, -// description = @DraftEventState.info.description, -// eventURL = @DraftEventState.info.eventURL, -// sponsoringOrg = @DraftEventState.info.sponsoringOrg, -// expectedStart = @DraftEventState.info.expectedStart, -// expectedEnd = @DraftEventState.info.expectedEnd, -// isPrivate = @DraftEventState.info.isPrivate, -// eventStatusInfo = !DelayedEventInfo( -// reason = @DelayEvent.reason, -// timeStartedOpt = startTimeIfPast(startTime = @ScheduledEventState.info.expectedStart) -// ) -// ), -// meta = !EventMetaInfo( -// createdOn = @DraftEventState.meta.createdOn, -// createdBy = @DraftEventState.meta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @CancelEvent.onBehalfOf, -// currentState = @EventStates.Delayed -// ) -// ) } } on command StartEvent{ @@ -303,8 +98,9 @@ context EventContext is { on command EndEvent{ error "Cannot end an event that has not started." } + // TODO: write AddLiveUpdate on clause on command AddLiveUpdate{ - ??? // TODO: write AddLiveUpdate on clause + ??? } } } @@ -330,155 +126,38 @@ context EventContext is { //} on command EditEventInfo { set field ScheduledEventState.info to "EventContext.newInfoFromFieldsPresentInEditable" -// ( -// editable = @EditEventInfo.info, -// oldInfo = @ScheduledEventState.info -// ) set field ScheduledEventState.meta to "EventMetaInfo" -// ( -// createdOn = @ScheduledEventState.meta.createdOn, -// createdBy = @ScheduledEventState.meta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @EditEventInfo.onBehalfOf, -// currentState = @EventStates.Scheduled -// ) - send event EventInfoEdited -// ( -// eventId = @ScheduledEventState.id, -// info = @ScheduledEventState.info, -// meta = @ScheduledEventState.meta -// ) - to outlet EventEvents.Events + send event EventInfoEdited to outlet EventEvents.Events } on command CancelEvent { "cancel associated scheduled call to emit StartEvent" - send event EventCancelled -// ( -// eventId = @CancelEvent.eventId, -// info = !EventInfo( -// eventName = @ScheduledEventState.info.eventName, -// description = @ScheduledEventState.info.description, -// eventURL = @ScheduledEventState.info.eventURL, -// sponsoringOrg = @ScheduledEventState.info.sponsoringOrg, -// expectedStart = @ScheduledEventState.info.expectedStart, -// expectedEnd = @ScheduledEventState.info.expectedEnd, -// isPrivate = @ScheduledEventState.info.isPrivate, -// eventStatusInfo = !CancelledEventInfo( -// reason = @CancelEvent.reason, -// timeStarted = startTimeIfPast(startTime = @ScheduledEventState.info.expectedStart), -// timeEnded = nowIfStartIsPast(startTime = @ScheduledEventState.info.expectedStart) -// ) -// ), -// meta = !EventMetaInfo( -// createdOn = @ScheduledEventState.meta.createdOn, -// createdBy = @ScheduledEventState.meta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @CancelEvent.onBehalfOf, -// currentState = @EventStates.Cancelled -// ) -// ) - to outlet EventEvents.Events + send event EventCancelled to outlet EventEvents.Events become entity Event to handler CancelledEventHandler } on command DelayEvent { "adjust associated scheduled Akka call to emit StartEvent" - send event EventDelayed -// ( -// eventId = @DelayEvent.eventId, -// info = !EventInfo( -// eventName = @ScheduledEventState.info.eventName, -// description = @ScheduledEventState.info.description, -// eventURL = @ScheduledEventState.info.eventURL, -// sponsoringOrg = @ScheduledEventState.info.sponsoringOrg, -// expectedStart = incrementDelayedEventTime( -// originalTime = @ScheduledEventState.info.expectedStart, -// duration = @DelayEvent.expectedDuration -// ), -// expectedEnd = incrementDelayedEventTime( -// originalTime = @ScheduledEventState.info.expectedEnd, -// duration = @DelayEvent.expectedDuration -// ), -// isPrivate = @ScheduledEventState.info.isPrivate, -// eventStatusInfo = !CancelledEventInfo( -// reason = @CancelEvent.reason, -// timeStarted = startTimeIfPast(startTime = @ScheduledEventState.info.expectedStart), -// timeEnded = nowIfStartIsPast(startTime = @ScheduledEventState.info.expectedStart) -// ) -// ), -// meta = !EventMetaInfo( -// createdOn = @ScheduledEventState.meta.createdOn, -// createdBy = @ScheduledEventState.meta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @DelayEvent.onBehalfOf, -// currentState = @EventStates.Delayed -// ) -// ) - to outlet EventEvents.Events + send event EventDelayed to outlet EventEvents.Events become entity Event to handler DelayedEventHandler } on command StartEvent{ "create scheduled Akka call using ScheduledEventState.info.expectedEnd to emit EndEvent" - send event EventStarted -// ( -// eventId = @StartEvent.eventId, -// info = !EventInfo( -// eventName = @ScheduledEventState.info.eventName, -// description = @ScheduledEventState.info.description, -// eventURL = @ScheduledEventState.info.eventURL, -// sponsoringOrg = @ScheduledEventState.info.sponsoringOrg, -// expectedStart = @ScheduledEventState.info.expectedStart, -// expectedEnd = @ScheduledEventState.info.expectedEnd, -// isPrivate = @ScheduledEventState.info.isPrivate, -// eventStatusInfo = !InProgressEventInfo( -// timeStarted = now() -// ) -// ), -// meta = !EventMetaInfo( -// createdOn = @ScheduledEventState.meta.createdOn, -// createdBy = @ScheduledEventState.meta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @StartEvent.onBehalfOf, -// currentState = @EventStates.InProgress -// ) -// ) - to outlet EventEvents.Events + send event EventStarted to outlet EventEvents.Events become entity Event to handler InProgressEventHandler } briefly "to be invoked by Akka scheduler upon ScheduleEvent reception" on command RescheduleEvent { if "start is validated to be before end in command" then { "adjust associated scheduled call to emit StartEvent" set field ScheduledEventState.info to "EventInfo" -// ( -// eventName = @ScheduledEventState.info.eventName, -// description = @ScheduledEventState.info.description, -// eventURL = @ScheduledEventState.info.eventURL, -// sponsoringOrg = @ScheduledEventState.info.sponsoringOrg, -// expectedStart = @RescheduleEvent.start, -// expectedEnd = @RescheduleEvent.end, -// isPrivate = @ScheduledEventState.info.isPrivate -// ) set field ScheduledEventState.meta to "EventMetaInfo" -// ( -// createdOn = @ScheduledEventState.meta.createdOn, -// createdBy = @ScheduledEventState.meta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @RescheduleEvent.onBehalfOf, -// currentState = @EventStates.Scheduled -// ) - send event EventRescheduled -// ( -// eventId = @ScheduledEventState.id, -// info = @ScheduledEventState.info, -// meta = @ScheduledEventState.meta -// ) - to outlet EventEvents.Events + send event EventRescheduled to outlet EventEvents.Events } } on command EndEvent{ error "End has not started. Cannot end an event that has not started." } + // TODO: implement AddLiveUpdate on command AddLiveUpdate { - ??? // TODO: implement AddLiveUpdate + ??? } } handler InProgressEventHandler is { @@ -499,72 +178,19 @@ context EventContext is { } on command DelayEvent{ "adjust associated scheduled Akka call to emit StartEvent" - send event EventDelayed -// ( -// eventId = @DelayEvent.eventId, -// info = !EventInfo( -// eventName = @ScheduledEventState.info.eventName, -// description = @ScheduledEventState.info.description, -// eventURL = @ScheduledEventState.info.eventURL, -// sponsoringOrg = @ScheduledEventState.info.sponsoringOrg, -// expectedStart = incrementDelayedEventTime( -// originalTime = @ScheduledEventState.info.expectedStart, -// duration = @DelayEvent.expectedDuration -// ), -// expectedEnd = incrementDelayedEventTime( -// originalTime = @ScheduledEventState.info.expectedEnd, -// duration = @DelayEvent.expectedDuration -// ), -// isPrivate = @ScheduledEventState.info.isPrivate, -// eventStatusInfo = !DelayedEventInfo( -// reason = @DelayEvent.reason, -// timeStartedOpt = startTimeIfPast(startTime = @ScheduledEventState.info.expectedStart) -// ) -// ), -// meta = !EventMetaInfo( -// createdOn = @ScheduledEventState.meta.createdOn, -// createdBy = @ScheduledEventState.meta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @DelayEvent.onBehalfOf, -// currentState = @EventStates.Delayed -// ) -// ) - to outlet EventEvents.Events + send event EventDelayed to outlet EventEvents.Events become entity Event to handler DelayedEventHandler } on command StartEvent { error "Event is already started. Cannot start an event that is already in progress" } on command EndEvent { - send event EventEnded -// ( -// eventId = @EndEvent.eventId, -// info = !EventInfo( -// eventName = @ScheduledEventState.info.eventName, -// description = @ScheduledEventState.info.description, -// eventURL = @ScheduledEventState.info.eventURL, -// sponsoringOrg = @ScheduledEventState.info.sponsoringOrg, -// expectedStart = @ScheduledEventState.info.expectedStart, -// expectedEnd = @ScheduledEventState.info.expectedEnd, -// isPrivate = @ScheduledEventState.info.isPrivate, -// eventStatusInfo = !PastEventInfo( -// timeStarted = @ScheduledEventState.info.eventStatusInfo.timeStarted, -// timeEnded = @ScheduledEventState.info.expectedStart -// ) -// ), -// meta = !EventMetaInfo( -// createdOn = @ScheduledEventState.meta.createdOn, -// createdBy = @ScheduledEventState.meta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @EndEvent.onBehalfOf, -// currentState = @EventStates.Past -// ) -// ) - to outlet EventEvents.Events + send event EventEnded to outlet EventEvents.Events become entity Event to handler PastEventHandler } + // TODO: specify AddLiveUpdate on clause on command AddLiveUpdate { - ??? // TODO: specify AddLiveUpdate on clause + ??? } } handler DelayedEventHandler is { @@ -576,85 +202,20 @@ context EventContext is { //} on command EditEventInfo{ set field ScheduledEventState.info to "EventContext.newInfoFromFieldsPresentInEditable" -// ( -// editable = @EditEventInfo.info, -// oldInfo = @ScheduledEventState.info -// ) set field ScheduledEventState.meta to "EventMetaInfo" -// ( -// createdOn = @ScheduledEventState.meta.createdOn, -// createdBy = @ScheduledEventState.meta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @EditEventInfo.onBehalfOf, -// currentState = @EventStates.Delayed -// ) - send event EventInfoEdited -// ( -// eventId = @ScheduledEventState.id, -// info = @ScheduledEventState.info, -// meta = @ScheduledEventState.meta -// ) - to outlet EventEvents.Events + send event EventInfoEdited to outlet EventEvents.Events } on command CancelEvent{ "cancel associated scheduled call to emit StartEvent" - send event EventCancelled -// ( -// eventId = @CancelEvent.eventId, -// info = !EventInfo( -// eventName = @ScheduledEventState.info.eventName, -// description = @ScheduledEventState.info.description, -// eventURL = @ScheduledEventState.info.eventURL, -// sponsoringOrg = @ScheduledEventState.info.sponsoringOrg, -// expectedStart = @ScheduledEventState.info.expectedStart, -// expectedEnd = @ScheduledEventState.info.expectedEnd, -// isPrivate = @ScheduledEventState.info.isPrivate, -// eventStatusInfo = !CancelledEventInfo( -// reason = @CancelEvent.reason, -// timeStarted = startTimeIfPast(startTime = @ScheduledEventState.info.expectedStart), -// timeEnded = nowIfStartIsPast(startTime = @ScheduledEventState.info.expectedStart) -// ) -// ), -// meta = !EventMetaInfo( -// createdOn = @ScheduledEventState.meta.createdOn, -// createdBy = @ScheduledEventState.meta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @CancelEvent.onBehalfOf, -// currentState = @EventStates.Cancelled -// ) -// ) - to outlet EventEvents.Events + send event EventCancelled to outlet EventEvents.Events become entity Event to handler CancelledEventHandler } on command RescheduleEvent{ if "start is validated to be before end in command" then { "adjust associated scheduled call to emit StartEvent" set field ScheduledEventState.info to "EventInfo" -// ( -// eventName = @ScheduledEventState.info.eventName, -// description = @ScheduledEventState.info.description, -// eventURL = @ScheduledEventState.info.eventURL, -// sponsoringOrg = @ScheduledEventState.info.sponsoringOrg, -// expectedStart = @RescheduleEvent.start, -// expectedEnd = @RescheduleEvent.end, -// isPrivate = @ScheduledEventState.info.isPrivate, -// eventStatusInfo = !ScheduledEventInfo() -// ) set field ScheduledEventState.meta to "EventMetaInfo" -// ( -// createdOn = @ScheduledEventState.meta.createdOn, -// createdBy = @ScheduledEventState.meta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @RescheduleEvent.onBehalfOf, -// currentState = @EventStates.Delayed -// ) - send event EventRescheduled -// ( -// eventId = @ScheduledEventState.id, -// info = @ScheduledEventState.info, -// meta = @ScheduledEventState.meta -// ) - to outlet EventEvents.Events + send event EventRescheduled to outlet EventEvents.Events } } on command DelayEvent{ @@ -662,37 +223,15 @@ context EventContext is { } on command StartEvent{ "create scheduled Akka call using ScheduledEventState.info.expectedEnd to emit EndEvent" - send event EventStarted -// ( -// eventId = @StartEvent.eventId, -// info = !EventInfo( -// eventName = @ScheduledEventState.info.eventName, -// description = @ScheduledEventState.info.description, -// eventURL = @ScheduledEventState.info.eventURL, -// sponsoringOrg = @ScheduledEventState.info.sponsoringOrg, -// expectedStart = @ScheduledEventState.info.expectedStart, -// expectedEnd = @ScheduledEventState.info.expectedEnd, -// isPrivate = @ScheduledEventState.info.isPrivate, -// eventStatusInfo = !InProgressEventInfo( -// timeStarted = now() -// ) -// ), -// meta = !EventMetaInfo( -// createdOn = @ScheduledEventState.meta.createdOn, -// createdBy = @ScheduledEventState.meta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @StartEvent.onBehalfOf, -// currentState = @EventStates.InProgress -// ) -// ) - to outlet EventEvents.Events + send event EventStarted to outlet EventEvents.Events become entity Event to handler InProgressEventHandler } briefly "to be invoked by Akka scheduler upon ScheduleEvent reception" on command EndEvent{ error "Only events that are InProgress may be ended. If you wish to end this event it must be started first. If you wish to cancel the event, please use the CancelEvent Command." } + // TODO: IMplement AddLiveUpdate in on clause on command AddLiveUpdate{ - ??? // TODO: IMplement AddLiveUpdate in on clause + ??? } } handler CancelledEventHandler is { @@ -700,31 +239,8 @@ context EventContext is { if "start is validated to be before end in command" then { "adjust associated scheduled call to emit StartEvent" set field ScheduledEventState.info to "EventInfo" -// ( -// eventName = @ScheduledEventState.info.eventName, -// description = @ScheduledEventState.info.description, -// eventURL = @ScheduledEventState.info.eventURL, -// sponsoringOrg = @ScheduledEventState.info.sponsoringOrg, -// expectedStart = @RescheduleEvent.start, -// expectedEnd = @RescheduleEvent.end, -// isPrivate = @ScheduledEventState.info.isPrivate, -// eventStatusInfo = !ScheduledEventInfo() -// ) set field ScheduledEventState.meta to "EventMetaInfo" -// ( -// createdOn = @ScheduledEventState.meta.createdOn, -// createdBy = @ScheduledEventState.meta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @RescheduleEvent.onBehalfOf, -// currentState = @EventStates.Scheduled -// ) - send event EventRescheduled -// ( -// eventId = @ScheduledEventState.id, -// info = @ScheduledEventState.info, -// meta = @ScheduledEventState.meta -// ) - to outlet EventEvents.Events + send event EventRescheduled to outlet EventEvents.Events } } on other { diff --git a/src/main/riddl/Events/eventReservationProjections.riddl b/src/main/riddl/Events/eventReservationProjections.riddl index 80e15e9b8..0957b3340 100644 --- a/src/main/riddl/Events/eventReservationProjections.riddl +++ b/src/main/riddl/Events/eventReservationProjections.riddl @@ -1,14 +1,14 @@ -query GetLocationForEvent is {event: EventId} -result LocationForEvent is {event: EventId, location: LocationId} -result EventNotFound is {} -result NoReservationForEvent is {} -result NoLocationForEventReservation is {} +query GetLocationForEvent is { event: EventId } +result LocationForEvent is { event: EventId, location: Venues.LocationId } +result EventNotFound is { ??? } +result NoReservationForEvent is { ??? } +result NoLocationForEventReservation is { ??? } context EventReservationProjections is { projector EventReservationView is { record EventReservationFields { event: EventId, - location: LocationId, + location: Venues.LocationId, reservation: ReservationId } handler EventReservationViewHandler is { diff --git a/src/main/riddl/Events/eventSources.riddl b/src/main/riddl/Events/eventSources.riddl index 3a11cfa8b..ce7673b9d 100644 --- a/src/main/riddl/Events/eventSources.riddl +++ b/src/main/riddl/Events/eventSources.riddl @@ -1,21 +1,21 @@ -// plant EventPlant is { -// pipe EventPipe is {???} -// } - source LiveUpdates is { outlet Updates is type LiveUpdate } explained as "This is a source for things that happen as an event progresses" +// plant EventPlant is { +// pipe EventPipe is {???} +// } + +//ReservationAddedToEvent, type PublicEventEvent is one of { - EventInfoChanged, - EventCreated, - EventScheduled, - //ReservationAddedToEvent, - EventCancelled, - EventRescheduled, - EventDelayed, - EventStarted, - EventEnded + Events.EventContext.EventInfoEdited, + Events.EventContext.EventCreated, + Events.EventContext.EventScheduled, + Events.EventContext.EventCancelled, + Events.EventContext.EventRescheduled, + Events.EventContext.EventDelayed, + Events.EventContext.EventStarted, + Events.EventContext.EventEnded } source EventEvents is { outlet Events is type PublicEventEvent diff --git a/src/main/riddl/Events/eventTypeDefinitions.riddl b/src/main/riddl/Events/eventTypeDefinitions.riddl index 8d6b3eef7..9d3804ae8 100644 --- a/src/main/riddl/Events/eventTypeDefinitions.riddl +++ b/src/main/riddl/Events/eventTypeDefinitions.riddl @@ -10,7 +10,7 @@ type EventSpecificDetails is one of {Game, Play, Concert, FundRaiser} type Game is {info: GameTypeInfo, statusInfo: GameStatusInfo} type GameStateInfo is one of {ScheduledGameInfo | InProgressGameInfo | DelayedGameInfo | PastGameInfo | CancelledGameInfo} -type ScheduledGameInfo is {} +type ScheduledGameInfo is { ??? } type InProgressGameInfo is {currentScore: Score} type DelayedGameInfo is {delayedScore: Score?} type PastGameInfo is {finalScore: Score} @@ -24,7 +24,7 @@ type FootballGame is { ??? } type FootballGameStateInfo is one of {ScheduledFootballGameInfo | InProgressFootballGameInfo | DelayedFootballGameInfo | PastFootballGameInfo | CancelledFootballGameInfo} -type ScheduledFootballGameInfo is {} +type ScheduledFootballGameInfo is { ??? } type InProgressFootballGameInfo is {yardsSoFarHome: Integer, yardsSoFarAway: Integer} type DelayedFootballGameInfo is {yardsSoFarHome: Integer?, yardsSoFarAway: Integer?} type PastFootballGameInfo is {totalYardsHome: Integer, totalYardsAway: Integer} @@ -72,7 +72,7 @@ type EditableEventInfo is { expectedStart: DateTime?, expectedEnd: DateTime?, isPrivate: Boolean?, - eventStatusInfo: EventStatusInfo? briefly "there is no need for DraftStatusInfo, so this will always be None in Draft state" + eventStatusInfo: EventStateInfo? briefly "there is no need for DraftStatusInfo, so this will always be None in Draft state" //eventDetails: EventSpecificDetails //eventTags: String+,// List of relevant, searchable tags that identify/describe this event } diff --git a/src/main/riddl/Gateway/DemoScenarioGateway/demoScenarioGateway.riddl b/src/main/riddl/Gateway/DemoScenarioGateway/demoScenarioGateway.riddl index 019eebcad..7d1e01ee6 100644 --- a/src/main/riddl/Gateway/DemoScenarioGateway/demoScenarioGateway.riddl +++ b/src/main/riddl/Gateway/DemoScenarioGateway/demoScenarioGateway.riddl @@ -1,5 +1,5 @@ context DemoScenarioGateway is { - options(gateway) + option gateway type StartScenario is command { numTenants: Integer, @@ -7,7 +7,7 @@ context DemoScenarioGateway is { maxOrgsWidth: Integer, numMembersPerOrg: Integer, numEventsPerOrg: Integer, - ticketTypesPerEvent: TicketType+ + //ticketTypesPerEvent: TicketType+ } briefly "contains all parameters for a DemoScenario - all Integers must be > 0 and at least one TicketType must be provided" type ScenarioStarted is event { @@ -15,7 +15,7 @@ context DemoScenarioGateway is { orgsByTenant: mapping from TenantId to OrganizationId+, membersByOrg: mapping from OrganizationId to MemberId+, eventsByOrg: mapping from OrganizationId to EventId+, - store: StoreId, + store: ImprovingApp.StoreContext.StoreId, ticketsByEvent: mapping from EventId to SKU+ } briefly "contains all data created for a DemoScenario with inter-related references in key mapping provided" @@ -28,4 +28,4 @@ context DemoScenarioGateway is { productInfo: ProductContext.ProductInfo, productMeta: ProductContext.ProductMetaInfo } -} \ No newline at end of file +} diff --git a/src/main/riddl/Gateway/EventGateway/eventStories.riddl b/src/main/riddl/Gateway/EventGateway/eventStories.riddl index 92eb1fddb..bba04f2a5 100644 --- a/src/main/riddl/Gateway/EventGateway/eventStories.riddl +++ b/src/main/riddl/Gateway/EventGateway/eventStories.riddl @@ -1,6 +1,8 @@ + +epic EventStories is { ??? } + // TODO: Convert this file to new style epics and cases // event stories -epic EventStories is { ??? } /* As an Owner of an Organization I would like to schedule an Event that is hosted by my Organization As an Owner of an Organization I would like to find a Location, Reserve the Location, and schedule my Event using that Reservation (easy button) diff --git a/src/main/riddl/Gateway/MemberGateway/memberGateway.riddl b/src/main/riddl/Gateway/MemberGateway/memberGateway.riddl index c72bdd8bd..37fa0dcf0 100644 --- a/src/main/riddl/Gateway/MemberGateway/memberGateway.riddl +++ b/src/main/riddl/Gateway/MemberGateway/memberGateway.riddl @@ -1,7 +1,7 @@ context MemberGateway is { - options(gateway) - - type MemberType is any of {Student, FacultyStaff, Vendor, Sponsor, General, Alumni, Parent, Fan} + option gateway + + type MemberType is any of {Student, FacultyStaff, Vendor, Sponsor, General, Alumni, StudentsParent, Fan} type MemberMap is mapping from MemberContext.MemberId to MemberInfo type NotificationPreference is any of {email, sms} type MemberState is any of {active, inactive, suspended, terminated} @@ -12,7 +12,7 @@ context MemberGateway is { lastName: String, mobileNumber: MobileNumber?, emailAddress: EmailAddress?, - notificationPreference: NotificationPreference, + notificationPreference: ImprovingApp.MemberContext.NotificationPreference, notificationOptIn: Boolean, //true indicates they allow notifications organizations: OrganizationId*, //Members must belong to at least one Organization? relatedMembers: String, //Primary use case is parent/student. I am sure there are others. Might be a better way to document such a relationship. @@ -26,11 +26,15 @@ context MemberGateway is { memberState: MemberState } - type RegisterMemberList is command {memberList: MemberMap+, registeringMember: MemberContext.MemberId} briefly "RegisterMemberList creates multiple members with a single call. The limitation is you can only define a single MemberType in each call, and all new Members must be assigned to an Organization (typically a BaseOrg)." - type MemberListRegistered is event {memberData:MemberData*} - type RegisterMember is command {memberToAdd: MemberMap, registeringMember: MemberContext.MemberId?} briefly "RegisterMember creates a single new member. As this could be a self-service request the OrganizationType is optional. Also registeringMember is optional - if you are registering yourself then you are the registering member for yourself - you just don't exist yet" + type GetMemberInfo is query {memberId: MemberContext.MemberId} + type MemberData is result {memberId: MemberContext.MemberId, memberInfo: MemberInfo, memberMeta: MemberMetaInfo} + type GetMemberForHandle is query {handle: String} + type MemberForHandle is result {memberId: MemberContext.MemberId?} + type RegisterMemberList is command {memberList: ImprovingApp.MemberContext.MemberMap+, registeringMember: MemberContext.MemberId} briefly "RegisterMemberList creates multiple members with a single call. The limitation is you can only define a single MemberType in each call, and all new Members must be assigned to an Organization (typically a BaseOrg)." + type MemberListRegistered is event {memberData: ImprovingApp.MemberContext.MemberData*} + type RegisterMember is command {memberToAdd: ImprovingApp.MemberContext.MemberMap, registeringMember: MemberContext.MemberId?} briefly "RegisterMember creates a single new member. As this could be a self-service request the OrganizationType is optional. Also registeringMember is optional - if you are registering yourself then you are the registering member for yourself - you just don't exist yet" type MemberRegistered is event {memberId: MemberContext.MemberId, memberInfo: MemberInfo, memberMeta: MemberMetaInfo} briefly "Event issued after either RegisterMember or RegisterMemberList is called. In the case of RegisterMemberList one event per member in the list is published." - type UpdateMemberInfo is command {memberMap:MemberMap, actingMember: MemberContext.MemberId} briefly "All member info will be overwritten as provided in this command. Best practice would be to retrieve current values first and modify attributes that you desire to change and submit the full MemberInfo object back." + type UpdateMemberInfo is command {memberMap: ImprovingApp.MemberContext.MemberMap, actingMember: MemberContext.MemberId} briefly "All member info will be overwritten as provided in this command. Best practice would be to retrieve current values first and modify attributes that you desire to change and submit the full MemberInfo object back." type MemberInfoUpdated is event {memberId: MemberContext.MemberId, memberInfo: MemberInfo, memberMeta: MemberMetaInfo} type ActivateMember is command {memberId: MemberContext.MemberId, actingMember: MemberContext.MemberId} type MemberActivated is event {memberId: MemberContext.MemberId, memberMeta: MemberMetaInfo} @@ -40,10 +44,4 @@ context MemberGateway is { type MemberSuspended is event {memberId: MemberContext.MemberId, memberMeta: MemberMetaInfo} type TerminateMember is command {memberId: MemberContext.MemberId, actingMember: MemberContext.MemberId} type MemberTerminated is event {memberId: MemberContext.MemberId, memberMeta: MemberMetaInfo} - type GetMemberInfo is query {memberId: MemberContext.MemberId} - type MemberData is result {memberId: MemberContext.MemberId, memberInfo: MemberInfo, memberMeta: MemberMetaInfo} - type GetMemberForHandle is query {handle: String} - type MemberForHandle is result {memberId: MemberContext.MemberId?} - - -} \ No newline at end of file +} diff --git a/src/main/riddl/Gateway/MemberGateway/memberStories.riddl b/src/main/riddl/Gateway/MemberGateway/memberStories.riddl index 33fb5c3fb..e22429883 100644 --- a/src/main/riddl/Gateway/MemberGateway/memberStories.riddl +++ b/src/main/riddl/Gateway/MemberGateway/memberStories.riddl @@ -1,12 +1,10 @@ -// TODO: Convert this file to new style epics and cases -//Member Gateway Stories -//As a person who would like to use the features of ImprovingApp I would like to register a new user account so that I can access those features user Member is "A member of an organization" +/* epic RegisterMember is { - user Member wants "to enroll" so that "member can use the Improving App" + Member wants "to enroll" so that "member can use the Improving App" } /* -story RegisterMember is { +epic RegisterMember is { capability is "Enroll the Member" benefit is "So Member can use ImprovingApp" author James is { @@ -31,9 +29,12 @@ story RegisterMember is { } } briefly "A story about registering a new Member in Improving.app" described as "This is the story of how a Member signs up in Improving.app" +// TODO: Convert this file to new style epics and cases +//Member Gateway Stories +//As a person who would like to use the features of ImprovingApp I would like to register a new user account so that I can access those features //As a Member I would like to check the balance of my iAppCoins Account to see if I have enough coin to make a purchase -story GetIAppCoinBalance is { +epic GetIAppCoinBalance is { As user Member wants to "check the balance of my iAppCoins Account" so that "I can check to see if I have enough coin to make a purchase" // capability is "Check iAppCoinAccount Balance" // benefit is "To verify there is enough coin to make a purchase" @@ -50,7 +51,7 @@ story GetIAppCoinBalance is { } //As a Member of ImprovingApp I would like to subscribe to Event Update Stream so I can follow the progress of Events -story GetEventUpdates is { +epic GetEventUpdates is { capability is "Member would like to receive event updates as notifications in their Inbox" benefit is "Member can stay up to date regarding the Event" case HappyPath is { @@ -61,7 +62,7 @@ story GetEventUpdates is { } //As a Member of ImprovingApp I would like to subscrbe to the Order Stream so I can track the progress of my Orders -story GetOrderUpdates is { +epic GetOrderUpdates is { capability is "Member would like to recieved notifications about thier Order status in their Inbox" benefit is "So they can know how their order is progressing toward completion" case HappyPath is { @@ -72,7 +73,7 @@ story GetOrderUpdates is { } //As a Member I would like to express interest in an Event that has not been Reserved -story IAmInterestedInAttending is { +epic IAmInterestedInAttending is { capability is "User Expresses interested in attending an Event that has not opened Ticket sales yet" beneift is "Get on the list of event notifications (like when tickets go on sale)" case HappyPath is { diff --git a/src/main/riddl/Gateway/NotificationGateway/notificationStories.riddl b/src/main/riddl/Gateway/NotificationGateway/notificationStories.riddl index 8dfb990ba..69965bd7a 100644 --- a/src/main/riddl/Gateway/NotificationGateway/notificationStories.riddl +++ b/src/main/riddl/Gateway/NotificationGateway/notificationStories.riddl @@ -1,6 +1,6 @@ +epic Notifications is { ??? } //Notification Gateway Stories // TODO: Convert to epics and cases -epic Notifications is { ??? } /* As a Member who made a purchase at a Store I would like to receive purchase receipts and order status details electronically As a Member I would like to download my Notifications (tickets, receipts, etc.) diff --git a/src/main/riddl/Gateway/OrderGateway/orderStories.riddl b/src/main/riddl/Gateway/OrderGateway/orderStories.riddl index 28108dc2d..319a78b72 100644 --- a/src/main/riddl/Gateway/OrderGateway/orderStories.riddl +++ b/src/main/riddl/Gateway/OrderGateway/orderStories.riddl @@ -1,7 +1,7 @@ +epic OrderGatewayStories is { ??? } //Order Gateway Stories // TODO: Convert this file to epics/cases -epic OrderGatewayStories is { ??? } /* As a Member attending an Event I would like to buy my Ticket to the Event online As a Member attending an Event I would like to buy my concession Products online @@ -10,7 +10,7 @@ As a Vendor I would like to notify Inventory about product loss (dropped hamburg //As a Member I would like to maintain my iAppCoins Account so that I can make purchases (funny money) (member has an iAppCoins Account) //As a Member I can deposit iAppCoins into my account so I can spend them within the app -story DepositCoins is { +epic DepositCoins is { capability is "Deposit coins in iAppCoin Account" benefit is "So Member can buy things within ImprovingApp" case HappyPath { @@ -29,7 +29,7 @@ story DepositCoins is { } //As a Member I would like to withdraw coins from my iAppCoinsAccount so that I can purchase products/tickets from a store -story WithdrawCoins is { +epic WithdrawCoins is { capability is "Withdraw coins from iAppCoin Account" benefit is "To pay for items a Member purchases" case HappyPath { diff --git a/src/main/riddl/Gateway/OrganizationGateway/organizationStories.riddl b/src/main/riddl/Gateway/OrganizationGateway/organizationStories.riddl index b76a5ca0d..3aba70c79 100644 --- a/src/main/riddl/Gateway/OrganizationGateway/organizationStories.riddl +++ b/src/main/riddl/Gateway/OrganizationGateway/organizationStories.riddl @@ -1,7 +1,7 @@ -//Organization Gateway Stories - epic OrganizationGatewayStories is { ??? } +//Organization Gateway Stories + // TODO: turn these stories into cases in the above epic // As an Owner of a Tenant I would like to create Organizations to track their Membership, Events, and Orders. // As an Owner of an Organization I would like to manage my Membership (add, remove members). diff --git a/src/main/riddl/Gateway/PlaceGateway/placeStories.riddl b/src/main/riddl/Gateway/PlaceGateway/placeStories.riddl index 5b003be35..b5e974700 100644 --- a/src/main/riddl/Gateway/PlaceGateway/placeStories.riddl +++ b/src/main/riddl/Gateway/PlaceGateway/placeStories.riddl @@ -1,162 +1,143 @@ -story CreateVenue is { +epic CreateVenue is { user Member wants to "create a Venue" so that "I can manage my Venue in ImprovingApp" - capability is "Create a Venue" - benefit is "So Members can create Venues in ImprovingApp" - author Alex is { - name: "Alex Weinstein" - email: "alex.weinstin@improving.com" - } + by author Alex + //"Create a new Venue" case HappyPath is { - title: "Create a new Venue" - scope domain {ImprovingApp} - interaction is { - arbitrary step from user Member "provide venue information" to user App - briefly "initial invocation", - arbitrary step from user App send command Venue.CreateVenue to user GatewayAPI - briefly "send creation message", - arbitrary step from user GatewayAPI "Create Venue" to entity ImprovingApp.VenueContext.Venues - briefly "add new venue", - arbitrary step from entity ImprovingApp.VenueContext.Venue "VenueCreated" to pipe ImprovingApp.VenueContext.VenueEvents - briefly "venue added" - arbitrary step from pipe ImprovingApp.VenueContext.VenueEvents "VenueEnrolled" to user App - } - example Success is { - when Member provides Venue object to App - then App sends CreateVenue message to GatewayAPI - and GatewayAPI forwards message to VenueContext - and Venue is created - and VenueCreated message is returned from VenueContext to GatewayAPI - and GatewayAPI forwards message to App - and App displays success notification to Member - } + //interaction is { + // arbitrary step from user Member "provide venue information" to user App + // briefly "initial invocation", + // arbitrary step from user App send command Venue.CreateVenue to user GatewayAPI + // briefly "send creation message", + // arbitrary step from user GatewayAPI "Create Venue" to entity ImprovingApp.VenueContext.Venues + // briefly "add new venue", + // arbitrary step from entity ImprovingApp.VenueContext.Venue "VenueCreated" to pipe ImprovingApp.VenueContext.VenueEvents + // briefly "venue added" + // arbitrary step from pipe ImprovingApp.VenueContext.VenueEvents "VenueEnrolled" to user App + //} + //example Success is { + // when Member provides Venue object to App + // then App sends CreateVenue message to GatewayAPI + // and GatewayAPI forwards message to VenueContext + // and Venue is created + // and VenueCreated message is returned from VenueContext to GatewayAPI + // and GatewayAPI forwards message to App + // and App displays success notification to Member + //} } } briefly "A story about creating a venue in Improving.app" described as "This is the story of how a venue comes into existence" -story CreateLocation is { - As user Member wants to "create a Venue" so that "I can manage my Locations in ImprovingApp" - benefit is "So Members can create Locations for Venues in ImprovingApp" - author Alex is { - name: "Alex Weinstein" - email: "alex.weinstin@improving.com" - } +//benefit is "So Members can create Locations for Venues in ImprovingApp" +epic CreateLocation is { + user Member wants to "create a Venue" so that "I can manage my Locations in ImprovingApp" + by author Alex + //"Create a new Location" case HappyPath is { - title: "Create a new Location" - scope domain {ImprovingApp} - interaction is { - arbitrary step from user Member "Location information" to user App - briefly "initial invocation", - arbitrary step from user App send command Location.CreateLocation to user GatewayAPI - briefly "send creation message", - arbitrary step from user GatewayAPI "Create Location" to entity ImprovingApp.LocationContext.Locations - briefly "add new location", - arbitrary step from entity ImprovingApp.LocationContext.Location "LocationCreated" to pipe ImprovingApp.LocationContext.LocationEvents - briefly "location added" - arbitrary step from pipe ImprovingApp.LocationContext.LocationEvents "LocationCreated" to user App - } - example Success is { - when Member provides Location object to App - then App sends CreateLocation message to GatewayAPI - and GatewayAPI forwards message to LocationContext - and Location is created - and LocationCreated message is returned from LocationContext to GatewayAPI - and GatewayAPI forwards message to App - and App displays success notification to Member - } + //interaction is { + // arbitrary step from user Member "Location information" to user App + // briefly "initial invocation", + // arbitrary step from user App send command Location.CreateLocation to user GatewayAPI + // briefly "send creation message", + // arbitrary step from user GatewayAPI "Create Location" to entity ImprovingApp.LocationContext.Locations + // briefly "add new location", + // arbitrary step from entity ImprovingApp.LocationContext.Location "LocationCreated" to pipe ImprovingApp.LocationContext.LocationEvents + // briefly "location added" + // arbitrary step from pipe ImprovingApp.LocationContext.LocationEvents "LocationCreated" to user App + //} + //example Success is { + // when Member provides Location object to App + // then App sends CreateLocation message to GatewayAPI + // and GatewayAPI forwards message to LocationContext + // and Location is created + // and LocationCreated message is returned from LocationContext to GatewayAPI + // and GatewayAPI forwards message to App + // and App displays success notification to Member + //} } } briefly "A story about creating a location in Improving.app" described as "This is the story of how a location comes into existence" -story UpdateLocationStatus is { - As user Member wants to "update a Location's status" so that "I can manage my Location statuses in ImprovingApp" - capability is "Make a Location Available for Reservation" - benefit is "So Members can allow other Members to make Reservations in their Locations in ImprovingApp" - author Alex is { - name: "Alex Weinstein" - email: "alex.weinstin@improving.com" - } +// benefit is "So Members can allow other Members to make Reservations in their Locations in ImprovingApp" +// capability is "Make a Location Available for Reservation" +epic UpdateLocationStatus is { + user Member wants to "update a Location's status" so that "I can manage my Location statuses in ImprovingApp" + by author Alex + //"Update Location Status to Available" case ToAvailableHappyPath is { - title: "Update Location Status to Available" - scope domain {ImprovingApp} - interaction is { - arbitrary step from user Member "presses button to update Location status to Available" to user App - briefly "initial invocation", - arbitrary step from user App send command Location.UpdateLocationStatus to user GatewayAPI - briefly "send update status message", - arbitrary step from user GatewayAPI "Update Location Status" to entity ImprovingApp.LocationContext.Locations - briefly "update location status", - arbitrary step from entity ImprovingApp.LocationContext.Location "LocationStatusUpdated" to pipe ImprovingApp.LocationContext.LocationEvents - briefly "location status updated" - arbitrary step from pipe ImprovingApp.LocationContext.LocationEvents "LocationStatusUpdated" to user App - } - example Success is { - when Member requests for UpdateLocationStatus to App with Available as its parameter - then App sends UpdateLocationStatus message to GatewayAPI - and GatewayAPI forwards message to LocationContext - and Location is updated to Available status - and LocationStatusUpdated message is returned from LocationContext to GatewayAPI - and GatewayAPI forwards message to App - and App displays success notification to Member - } + //interaction is { + // arbitrary step from user Member "presses button to update Location status to Available" to user App + // briefly "initial invocation", + // arbitrary step from user App send command Location.UpdateLocationStatus to user GatewayAPI + // briefly "send update status message", + // arbitrary step from user GatewayAPI "Update Location Status" to entity ImprovingApp.LocationContext.Locations + // briefly "update location status", + // arbitrary step from entity ImprovingApp.LocationContext.Location "LocationStatusUpdated" to pipe ImprovingApp.LocationContext.LocationEvents + // briefly "location status updated" + // arbitrary step from pipe ImprovingApp.LocationContext.LocationEvents "LocationStatusUpdated" to user App + //} + //example Success is { + // when Member requests for UpdateLocationStatus to App with Available as its parameter + // then App sends UpdateLocationStatus message to GatewayAPI + // and GatewayAPI forwards message to LocationContext + // and Location is updated to Available status + // and LocationStatusUpdated message is returned from LocationContext to GatewayAPI + // and GatewayAPI forwards message to App + // and App displays success notification to Member + //} } } briefly "A story about updating a location's status to Available in Improving.app" described as "This is the story of how a location becomes available" -story SearchAvailableLocations is { - As user Member wants to "search for available Locations given specific parameters" so that "I can make a Reservation in an available Location in ImprovingApp" - capability is "Search (parameterized) for a Location that is available for Reservation" - benefit is "So Members can find Locations for making Reservations in ImprovingApp according to desired specifications" - author Alex is { - name: "Alex Weinstein" - email: "alex.weinstin@improving.com" - } +// capability is "Search (parameterized) for a Location that is available for Reservation" +// benefit is "So Members can find Locations for making Reservations in ImprovingApp according to desired specifications" +epic SearchAvailableLocations is { + user Member wants to "search for available Locations given specific parameters" so that "I can make a Reservation in an available Location in ImprovingApp" + by author Alex + //"Search for available Locations according to time range parameters" case TimeSearchHappyPath is { - title: "Search for available Locations according to time range parameters" - scope domain {ImprovingApp} - interaction is { - arbitrary step from user Member "searches for location availability with time based parameters" to user App - briefly "initial invocation", - arbitrary step from user App send command Location.SearchAvailableLocations to user GatewayAPI - briefly "send search message", - arbitrary step from user GatewayAPI "Search Available Locations" to entity ImprovingApp.LocationContext.Locations - briefly "search for available locations according to provided parameters", - arbitrary step from entity ImprovingApp.LocationContext.Location "LocationSearchResults" to pipe ImprovingApp.LocationContext.LocationEvents - briefly "location search results" - arbitrary step from pipe ImprovingApp.LocationContext.LocationEvents "LocationSearchResults" to user App - } - example Success is { - when Member requests for SearchAvailableLocations to App with a time range or series of them as its parameter - then App sends SearchAvailableLocations message to GatewayAPI - and GatewayAPI forwards message to LocationContext - and Locations are found that are available - and LocationSearchResults message is returned from LocationContext to GatewayAPI - and GatewayAPI forwards message to App - and App displays success notification to Member - } + //interaction is { + // arbitrary step from user Member "searches for location availability with time based parameters" to user App + // briefly "initial invocation", + // arbitrary step from user App send command Location.SearchAvailableLocations to user GatewayAPI + // briefly "send search message", + // arbitrary step from user GatewayAPI "Search Available Locations" to entity ImprovingApp.LocationContext.Locations + // briefly "search for available locations according to provided parameters", + // arbitrary step from entity ImprovingApp.LocationContext.Location "LocationSearchResults" to pipe ImprovingApp.LocationContext.LocationEvents + // briefly "location search results" + // arbitrary step from pipe ImprovingApp.LocationContext.LocationEvents "LocationSearchResults" to user App + //} + //example Success is { + // when Member requests for SearchAvailableLocations to App with a time range or series of them as its parameter + // then App sends SearchAvailableLocations message to GatewayAPI + // and GatewayAPI forwards message to LocationContext + // and Locations are found that are available + // and LocationSearchResults message is returned from LocationContext to GatewayAPI + // and GatewayAPI forwards message to App + // and App displays success notification to Member + //} } + //"Search for available Locations according to capacity parameters" case CapacitySearchHappyPath is { - title: "Search for available Locations according to capacity parameters" - scope domain {ImprovingApp} - interaction is { - arbitrary step from user Member "SearchAvailableLocations" to user App - briefly "initial invocation", - arbitrary step from user App send command Location.SearchAvailableLocations to user GatewayAPI - briefly "send search message", - arbitrary step from user GatewayAPI "searches for location availability with capacity based parameters" to entity ImprovingApp.LocationContext.Locations - briefly "search for available locations according to provided parameters", - arbitrary step from entity ImprovingApp.LocationContext.Location "LocationSearchResults" to pipe ImprovingApp.LocationContext.LocationEvents - briefly "location search results" - arbitrary step from pipe ImprovingApp.LocationContext.LocationEvents "LocationSearchResults" to user App - } - example Success is { - when Member requests SearchAvailableLocations to App with a maxCapacity as its parameter - then App sends SearchAvailableLocations message to GatewayAPI - and GatewayAPI forwards message to LocationContext - and Locations are found that are available - and LocationSearchResults message is returned from LocationContext to GatewayAPI - and GatewayAPI forwards message to App - and App displays success notification to Member - } + //interaction is { + // arbitrary step from user Member "SearchAvailableLocations" to user App + // briefly "initial invocation", + // arbitrary step from user App send command Location.SearchAvailableLocations to user GatewayAPI + // briefly "send search message", + // arbitrary step from user GatewayAPI "searches for location availability with capacity based parameters" to entity ImprovingApp.LocationContext.Locations + // briefly "search for available locations according to provided parameters", + // arbitrary step from entity ImprovingApp.LocationContext.Location "LocationSearchResults" to pipe ImprovingApp.LocationContext.LocationEvents + // briefly "location search results" + // arbitrary step from pipe ImprovingApp.LocationContext.LocationEvents "LocationSearchResults" to user App + //} + //example Success is { + // when Member requests SearchAvailableLocations to App with a maxCapacity as its parameter + // then App sends SearchAvailableLocations message to GatewayAPI + // and GatewayAPI forwards message to LocationContext + // and Locations are found that are available + // and LocationSearchResults message is returned from LocationContext to GatewayAPI + // and GatewayAPI forwards message to App + // and App displays success notification to Member + //} } } briefly "A story about searching for available locations in Improving.app" described as "This is the story of how available locations are found according to user parameters" diff --git a/src/main/riddl/Gateway/ProductGateway/productStories.riddl b/src/main/riddl/Gateway/ProductGateway/productStories.riddl index 7f54eb369..952e68759 100644 --- a/src/main/riddl/Gateway/ProductGateway/productStories.riddl +++ b/src/main/riddl/Gateway/ProductGateway/productStories.riddl @@ -1,5 +1,11 @@ +epic CreateProduct is { + ??? +} + //Product Gateway Stories -As a Vendor I would like to create a Product so that I can list it in a Store - - picture - - name - - description \ No newline at end of file + +/*As a Vendor I would like to create a Product so that I can list it in a Store + - picture + - name + - description +*/ diff --git a/src/main/riddl/Gateway/ReservationGateway/reservationStories.riddl b/src/main/riddl/Gateway/ReservationGateway/reservationStories.riddl index 41dcba87d..4a8a8f782 100644 --- a/src/main/riddl/Gateway/ReservationGateway/reservationStories.riddl +++ b/src/main/riddl/Gateway/ReservationGateway/reservationStories.riddl @@ -1,51 +1,35 @@ -//Reservation Gateway Stories -story CreateReservation { - As user Member wants to "Create a Reservation" so that "I can manage my Reservations & book them in ImprovingApp" - author Alex is { - name: "Alex Weinstein" - email: "alex.weinstin@improving.com" - } +epic CreateReservation { + user ImprovingApp.GatewayAPI.Member wants to "Create a Reservation" so that "I can manage my Reservations & book them in ImprovingApp" + by author Alex + + //"Create a new Reservation without booking it" case HappyPath is { - title: "Create a new Reservation without booking it" - scope domain {ImprovingApp} - interaction is { - step from user Member "provides a ReservationId" to user App - briefly "initial invocation", - step from user App send command Reservation.CreateReservation to user GatewayAPI - // briefly "send creation message", - // step from user GatewayAPI "Create Reservation" to entity ImprovingApp.ReservationContext.Reservations - // briefly "create reservation", - // step from entity ImprovingApp.ReservationContext.Reservations "ReservationCreated" to pipe ImprovingApp.ReservationContext.ReservationEvents - // briefly "reservation created" - // step from pipe ImprovingApp.ReservationContext.ReservationEvents "ReservationCreated" to user App - } - example Success is { - // when Member provides CreateReservation command w/ necessary info to App - // then App sends CreateReservation message to GatewayAPI - // and GatewayAPI forwards message to ReservationContext - // and Reservation is booked - // and ReservationCreated message is returned from ReservationContext to GatewayAPI - // and GatewayAPI forwards message to App - // and App displays success notification to Member - } + step from user ImprovingApp.GatewayAPI.Member "provides a ReservationId" to user App + briefly "initial invocation" + step send command EstablishReservation from application App to context GatewayAPI + briefly "send creation message" + step from user GatewayAPI "Create Reservation" to entity ImprovingApp.Events.ReservationContext.Reservation + briefly "create reservation" + step send event ImprovingApp.Events.ReservationContext.ReservationEstablished + from entity ImprovingApp.Events.ReservationContext.Reservation to source ImprovingApp.Events.ReservationContext.PublicReservationEvent + briefly "reservation created" + step send event ImprovingApp.Events.ReservationContext.ReservationEstablished + from source ImprovingApp.Events.ReservationContext.PublicReservationEvent to application App } } briefly "A story about creating a reservation in Improving.app" described as "This is the story of how a reservation comes into existence" +//Reservation Gateway Stories -story BookReservation is { - As user Member wants to "Book a Reservation" so that "I can book my Reservations in ImprovingApp" - author Alex is { - name: "Alex Weinstein" - email: "alex.weinstin@improving.com" - } +epic BookReservation is { + user Member wants to "Book a Reservation" so that "I can book my Reservations in ImprovingApp" + by author Alex + //"Book a new Reservation by picking from a list, given time parameters" case TimePickHappyPath is { - title: "Book a new Reservation by picking from a list, given time parameters" - scope domain {ImprovingApp} - interaction is { - step from user Member "provide time range" to user App - briefly "initial invocation", - step from user App send command Reservation.FindLocationsAvailability to user GatewayAPI - briefly "send availability query", + //interaction is { + // step from user Member "provide time range" to user App + // briefly "initial invocation", + // step from user App send command Reservation.FindLocationsAvailability to user GatewayAPI + // briefly "send availability query", // step from user GatewayAPI "Find Availability for Locations" to entity ImprovingApp.LocationContext.Locations // briefly "find available locations given parameters", // step from entity ImprovingApp.LocationContext.Locations "LocationsAvailabilityResults" to pipe ImprovingApp.LocationContext.LocationEvents @@ -60,8 +44,8 @@ story BookReservation is { // step from entity ImprovingApp.ReservationContext.Reservations "ReservationBooked" to pipe ImprovingApp.ReservationContext.ReservationEvents // briefly "reservation booked" // step from pipe ImprovingApp.ReservationContext.ReservationEvents "ReservationBooked" to user App - } - example Success is { + //} + //example Success is { // when Member queries for FindLocationsAvailability while providing a time range to App // then App sends FindLocationsAvailability message to GatewayAPI // and GatewayAPI forwards message to LocationContext @@ -77,14 +61,13 @@ story BookReservation is { // and App displays success notification to Member } } + //"Book a new Reservation by picking from a list, given maxCapacity parameter" case MaxCapacityPickHappyPath is { - title: "Book a new Reservation by picking from a list, given maxCapacity parameter" - scope domain {ImprovingApp} - interaction is { - step from user Member "provide maxCapacity" to user App - briefly "initial invocation", - step from user App send command Reservation.FindLocationsAvailability to user GatewayAPI - briefly "send availability query", + //interaction is { + // step from user Member "provide maxCapacity" to user App + // briefly "initial invocation", + // step from user App send command Reservation.FindLocationsAvailability to user GatewayAPI + // briefly "send availability query", // step from user GatewayAPI "Find Availability for Locations" to entity ImprovingApp.LocationContext.Locations // briefly "find available reservations given parameters", // step from entity ImprovingApp.LocationContext.Locations "LocationsAvailabilityResults" to pipe ImprovingApp.LocationContext.LocationEvents @@ -99,8 +82,8 @@ story BookReservation is { // step from entity ImprovingApp.ReservationContext.Reservations "ReservationBooked" to pipe ImprovingApp.ReservationContext.ReservationEvents // briefly "reservation booked" // step from pipe ImprovingApp.ReservationContext.ReservationEvents "ReservationBooked" to user App - } - example Success is { + //} + //example Success is { // when Member queries for FindLocationsAvailability while providing a maxCapacity to App // then App sends FindLocationsAvailability message to GatewayAPI // and GatewayAPI forwards message to LocationContext @@ -114,23 +97,22 @@ story BookReservation is { // and ReservationBooked message is returned from ReservationContext to GatewayAPI // and GatewayAPI forwards message to App // and App displays success notification to Member - } + //} } + //"Book a new Reservation automatically based on what is available next, parameterized by Reservation info" case NextAvailableHappyPath is { - title: "Book a new Reservation automatically based on what is available next, parameterized by Reservation info" - scope domain {ImprovingApp} - interaction is { - step from user Member "asks to book next Reservation with search parameters based ReservationInfo in a provided ReservationId" to user App - briefly "initial invocation", - step from user App send command Location.BookNextAvailable to user GatewayAPI - briefly "send smart booking query", + //interaction is { + // step from user Member "asks to book next Reservation with search parameters based ReservationInfo in a provided ReservationId" to user App + // briefly "initial invocation", + // step from user App send command Location.BookNextAvailable to user GatewayAPI + // briefly "send smart booking query", // step from user GatewayAPI "Book Next Available Location" to entity ImprovingApp.LocationContext.Locations // briefly "find available locations & automatically book one given fields of info provided", // step from entity ImprovingApp.ReservationContext.Reservations "ReservationBooked" to pipe ImprovingApp.ReservationContext.ReservationEvents // briefly "reservation booked" // step from pipe ImprovingApp.ReservationContext.ReservationEvents "ReservationBooked" to user App } - example Success is { + //example Success is { // when Member sends BookNextAvailable command while providing a ReservationInfo to App // then App sends BookNextAvailable message to GatewayAPI // and GatewayAPI forwards message to ReservationContext diff --git a/src/main/riddl/Gateway/StoreGateway/storeStories.riddl b/src/main/riddl/Gateway/StoreGateway/storeStories.riddl index 350ca6fd6..ca40c2a5c 100644 --- a/src/main/riddl/Gateway/StoreGateway/storeStories.riddl +++ b/src/main/riddl/Gateway/StoreGateway/storeStories.riddl @@ -1,6 +1,21 @@ +epic CreateVendor { + ??? +} described as "As the Owner of an Event I would like to create a Store to sell Tickets to my Event and Products at my Event" + +epic ListAndPriceEventAndProducts { + ??? +} described as "As Vendor of a Store I would like to list and price and set inventory for Tickets to Events and Products I intend to sell in the Store" + +epic InventoryAndProductTracking { + ??? +} described as "As Vendor of a Store I would like to track Inventory of Tickets/Products so I don't oversell at the Store" + +epic RealTimeSalesReporting { + ??? +} described as "As Vendor of a Store I would like to view near real time reports about sales" + +epic MarkOrderDelivered { + ??? +} described as "As a Vendor of a Store I would like to mark an Order delivered when a Member receives their order" + //Store Gateway Stories -As the Owner of an Event I would like to create a Store to sell Tickets to my Event and Products at my Event -As Vendor of a Store I would like to list and price and set inventory for Tickets to Events and Products I intend to sell in the Store -As Vendor of a Store I would like to track Inventory of Tickets/Products so I don't oversell at the Store -As Vendor of a Store I would like to view near real time reports about sales -As a Vendor of a Store I would like to mark an Order delivered when a Member receives their order \ No newline at end of file diff --git a/src/main/riddl/Gateway/TenantGateway/tenantStories.riddl b/src/main/riddl/Gateway/TenantGateway/tenantStories.riddl index 86b0dc8a4..b1e724bd9 100644 --- a/src/main/riddl/Gateway/TenantGateway/tenantStories.riddl +++ b/src/main/riddl/Gateway/TenantGateway/tenantStories.riddl @@ -1,2 +1,6 @@ +epic CreateTenant { + ??? +} described as "As a Member I would like to create a new Tenant so that I can use its features within my Organization. + I am now the Owner of that Tenant." + //Tenant Gateway Stories -As a Member I would like to create a new Tenant so that I can use its features within my Organization. I am now the Owner of that Tenant. \ No newline at end of file diff --git a/src/main/riddl/Gateway/VendorGateway/vendorStories.riddl b/src/main/riddl/Gateway/VendorGateway/vendorStories.riddl index bf47e0c6e..7abcfe0a0 100644 --- a/src/main/riddl/Gateway/VendorGateway/vendorStories.riddl +++ b/src/main/riddl/Gateway/VendorGateway/vendorStories.riddl @@ -1,3 +1,9 @@ +epic VendorStories is { + ??? +} + //Vendor Gateway Stories +/* As an Owner of a Organization I want to create a Vendor to manage Stores at my Event - Vendor must create a Tenant, then an Org, then Vendor, then Store(s) +*/ \ No newline at end of file diff --git a/src/main/riddl/Gateway/actorDefinitions.riddl b/src/main/riddl/Gateway/actorDefinitions.riddl index eab86a962..fed59cca2 100644 --- a/src/main/riddl/Gateway/actorDefinitions.riddl +++ b/src/main/riddl/Gateway/actorDefinitions.riddl @@ -1,3 +1,4 @@ +actor AnonUser is "A non-enrolled anonymous user" actor Member is "The person that is being enrolled" -actor App is "The applicaiton the user is using to perform this action" +actor App is "The application the user is using to perform this action" actor GatewayAction is "The interface that accepts the request for processing by the backend" \ No newline at end of file diff --git a/src/main/riddl/Gateway/gateway.riddl b/src/main/riddl/Gateway/gateway.riddl index 4e758f895..edcaa10df 100644 --- a/src/main/riddl/Gateway/gateway.riddl +++ b/src/main/riddl/Gateway/gateway.riddl @@ -6,7 +6,6 @@ domain GatewayAPI is { include "EventGateway/eventStories" include "MemberGateway/memberStories" include "MemberGateway/memberGateway" - include "MemberGateway/memberEpics" include "NotificationGateway/notificationStories" include "OrderGateway/orderStories" include "PlaceGateway/placeStories" diff --git a/src/main/riddl/Gateway/gatewayEpics.riddl b/src/main/riddl/Gateway/gatewayEpics.riddl index 8fea22cea..b57bebf30 100644 --- a/src/main/riddl/Gateway/gatewayEpics.riddl +++ b/src/main/riddl/Gateway/gatewayEpics.riddl @@ -1,12 +1,13 @@ -epic DemoMVP by author Alex is { +epic DemoMVP is { user DemoMember wants "to use the app to participate in a demo" so that "they can assess the app" + by author Alex term 'demo' briefly "An interactive presentation using Improving.App to buy tickets to events, potentially during a IT nightmare scenario" case StartScenario is { sequence { step from user DemoAdmin "create scenario data according to (mostly) integer-based parameters" to - input CommandLine.Scenario.StartScenario briefly "initial invocation for data generation", + input CommandLine.Scenario.StartScenario briefly "initial invocation for data generation" step from output CommandLine.Scenario.DisplayScenario "presented" to user DemoAdmin briefly "scenario successfully created according to parameters" } @@ -15,7 +16,7 @@ epic DemoMVP by author Alex is { case RegisterMember is { sequence { step from user DemoMember "register up as a member" to - input UserInterface.Member.RegisterMember briefly "member registration invocation", + input UserInterface.Member.RegisterMember briefly "member registration invocation" step from output UserInterface.Member.DisplayMemberDetails "presented" to user DemoAdmin briefly "member successfully registered" } @@ -24,7 +25,7 @@ epic DemoMVP by author Alex is { case PurchaseTicket is { parallel { step from user DemoMember "purchase ticket" to input UserInterface.Product.PurchaseProduct - briefly "purchase ticket invocation", + briefly "purchase ticket invocation" step from output UserInterface.Product.DisplayPurchases "presented" to user DemoAdmin briefly "ticket successfully purchased" } diff --git a/src/main/riddl/Gateway/gatewayStories.riddl b/src/main/riddl/Gateway/gatewayStories.riddl index 6bd14f005..c756dc776 100644 --- a/src/main/riddl/Gateway/gatewayStories.riddl +++ b/src/main/riddl/Gateway/gatewayStories.riddl @@ -1,33 +1,27 @@ -// TODO: Convert this file to new syntax for epics and applicaiton -// Member Stories (James) -//As a person who would like to use the features of ImprovingApp I would like to register a new user account so that I can access those features -epic RegisterMember is { ??? } -/* -story RegisterMember is { - capability is "Register the Member" - benefit is "So Member can use ImprovingApp" - author James is { - name: "James Lovell" - email: "james.lovell@improving.com" - } +epic RegisterMember { + user ImprovingApp.GatewayAPI.AnonUser wants to "register himself" so that "they can use ImprovingApp" + by author James + case HappyPath is { - title: "Register a new Member - Happy Path" - scope domain {ImprovingApp} - interaction is { - step from user Member "RegisterMember" to user App - briefly "initial invocation", - step from app App send command Member.RegisterMember to user GatewayAPI - briefly "send creation message", - step from context GatewayAPI "Register Member" to entity ImprovingApp.MemberContext.Member - briefly "add new Member", - step from entity ImprovingApp.MemberContext.Member "MemberRegistered" to pipe ImprovingApp.MemberContext.MemberEvents - briefly "Member added in Draft state" - step from pipe ImprovingApp.MemberContext.MemberEvents "MemberRegistered" to user App - } + step from user ImprovingApp.GatewayAPI.Member "RegisterMember" to user App + briefly "initial invocation" + step send command ImprovingApp.MemberContext.RegisterMember from application UserInterface to context GatewayAPI + briefly "send creation message" + step from context GatewayAPI "Register Member" to entity ImprovingApp.MemberContext.Member + briefly "add new Member" + step send event ImprovingApp.MemberContext.MemberRegistered from entity ImprovingApp.MemberContext.Member to source ImprovingApp.MemberContext.MemberEvents + briefly "Member added in Draft state" + step send event ImprovingApp.MemberContext.MemberRegistered from source ImprovingApp.MemberContext.MemberEvents to application App //example Foo is {...} } } briefly "A story about registering a member in Improving.app" described as "This is the story of how a member comes to existence in Improving.app" + +// TODO: Convert this file to new syntax for epics and applicaiton +// Member Stories (James) +//As a person who would like to use the features of ImprovingApp I would like to register a new user account so that I can access those features +epic RegisterMember is { ??? } + As a Member I would like to maintain my iAppCoins Account so that I can make purchases (funny money) As a user of ImprovingApp I can deposit iAppCoins into my account so I can spend them within the app As a Member I would like to check the balance of my iAppCoins Account to see if I have enough coin to make a purchase @@ -51,7 +45,7 @@ As an Owner of an Organization I would like to find a Location, Reserve the Loca - After creating an event but before scheduling an event (booking a reservation) - Gather interest in an event prior to Reserving the event -story EventBookingEasyButton is { +epic EventBookingEasyButton is { case primary is { step from user Owner "presses easy button to make a reservation" to input ImprovingApp.Improving_app.MyEventsPages.easy diff --git a/src/main/riddl/ImprovingApp.conf b/src/main/riddl/ImprovingApp.conf index 0848cef5b..4a9f180c4 100644 --- a/src/main/riddl/ImprovingApp.conf +++ b/src/main/riddl/ImprovingApp.conf @@ -6,14 +6,16 @@ command = hugo # This block provides options that are common to any command. common = { show-times = true + show-include-times = true verbose = false quiet = false dry-run = false - hide-warnings = true - hide-missing-warnings = true - hide-style-warnings = true + show-warnings = true + show-missing-warnings = false + show-style-warnings = false + show-usage-warnings = false debug = false - show-unused-warnings = false + group-by-message-kind = true } # This block provides options for the "hugo" command to translate riddl to a hugo web site. diff --git a/src/main/riddl/ImprovingApp.riddl b/src/main/riddl/ImprovingApp.riddl index 93d9c1593..c66018c96 100644 --- a/src/main/riddl/ImprovingApp.riddl +++ b/src/main/riddl/ImprovingApp.riddl @@ -1,19 +1,11 @@ -// (c) 2022 Improving Inc. All Rights Reserved. - -// This file is the top level RIDDL definition file for the Improving Application. -// It merely includes the subodmains and bounded contexts that make up the full domain. domain ImprovingApp is { + include "Common/Contact" + include "Common/Chrono" include "authors" include "Epics/epics" include "Applications/application" - include "Common/Contact" - // include "Common/UniqueIds" - include "Common/Chrono" include "Accounting/accounting" include "Calendars/calendar" - //include "Commerce/commerce" - //include "Inventory/inventory" - //include "Vendors/vendor" include "Gateway/gateway" include "Members/members" include "Organization/organization" @@ -23,6 +15,9 @@ domain ImprovingApp is { include "Venues/venue" include "Store/Store" include "Product/product" + include "Commerce/commerce" + include "Inventory/inventory" + include "Vendors/vendor" include "Events/eventReservationProjections" include "Tenant/tenantProjections" include "AllIdsProjections/allIdsProjections" @@ -31,3 +26,8 @@ domain ImprovingApp is { include "MembersAttendingEventsForAnOrganizationProjection/membersAttendingEventsForAnOrganizationProjection" include "test/TestGateway" } described in file "ImprovingApp.md" + +// This file is the top level RIDDL definition file for the Improving Application. +// It merely includes the subodmains and bounded contexts that make up the full domain. + +// (c) 2022 Improving Inc. All Rights Reserved. \ No newline at end of file diff --git a/src/main/riddl/Inventory/inventory.riddl b/src/main/riddl/Inventory/inventory.riddl index e9596e66c..3d7246985 100644 --- a/src/main/riddl/Inventory/inventory.riddl +++ b/src/main/riddl/Inventory/inventory.riddl @@ -2,9 +2,9 @@ domain InventoryDomain is { context ProductInventory is { entity Product is { type NullState is Nothing - state ActiveState of ^NullState is {???} + state ActiveState of ImprovingApp.InventoryDomain.ProductInventory.Product.NullState is {???} handler AvailableProductHandler is {???} - state EmptyState of ^NullState is {???} + state EmptyState of ImprovingApp.InventoryDomain.ProductInventory.Product.NullState is {???} handler EmptyStateHandler is {???} } } diff --git a/src/main/riddl/KalixStudy.conf b/src/main/riddl/KalixStudy.conf index 1c765fb28..e97fd8ec3 100644 --- a/src/main/riddl/KalixStudy.conf +++ b/src/main/riddl/KalixStudy.conf @@ -5,7 +5,7 @@ command = hugo # This block provides options that are common to any command. common = { - show-times = true + show-include-times = true verbose = false quiet = false dry-run = false @@ -14,6 +14,7 @@ common = { hide-style-warnings = true debug = false show-unused-warnings = false + group-by-message-kind = true } # This block provides options for the "hugo" command to translate riddl to a hugo web site. diff --git a/src/main/riddl/KalixStudy.riddl b/src/main/riddl/KalixStudy.riddl index 8be39f7e9..a30f575cb 100644 --- a/src/main/riddl/KalixStudy.riddl +++ b/src/main/riddl/KalixStudy.riddl @@ -2,7 +2,8 @@ // This file is the top level RIDDL definition file for the Improving Application. // It merely includes the subodmains and bounded contexts that make up the full domain. -domain ImprovingApp by author James is { +domain ImprovingApp is { + by author James include "authors" include "Common/Contact" include "Common/Chrono" diff --git a/src/main/riddl/LocationsReservationsProjections/locationsReservationsProjections.riddl b/src/main/riddl/LocationsReservationsProjections/locationsReservationsProjections.riddl index 6985ed76b..330d982d0 100644 --- a/src/main/riddl/LocationsReservationsProjections/locationsReservationsProjections.riddl +++ b/src/main/riddl/LocationsReservationsProjections/locationsReservationsProjections.riddl @@ -5,15 +5,15 @@ query ScheduleEasyEvent is { bufferEndMins: Integer, schedulingMember: MemberId } -result EasyEventNoAvailability is {} -result EasyScheduledEvent is {locations: LocationId+} +result EasyEventNoAvailability is { ??? } +result EasyScheduledEvent is {locations: Venues.LocationId+} context LocationsReservationsProjections is { projector LocationsReservationsView is { record LocationsReservationsFields { venueId: VenueId, orgId: OrganizationId, - locationId: LocationId, + locationId: Venues.LocationId, capacity: Integer, reservationId: ReservationId, reservationStart: TimeStamp, diff --git a/src/main/riddl/Members/members.riddl b/src/main/riddl/Members/members.riddl index a16c4d4bd..acc04ca5e 100644 --- a/src/main/riddl/Members/members.riddl +++ b/src/main/riddl/Members/members.riddl @@ -3,12 +3,12 @@ context MemberContext is { briefly "Unique identifier for Tenant Entity" type PublicMemberEvent is one of { - MemberRegistered, - MemberActivated, - MemberSuspended, - MemberTerminated, - MemberInfoEdited, - MemberData + ImprovingApp.MemberContext.MemberRegistered, + ImprovingApp.MemberContext.MemberActivated, + ImprovingApp.MemberContext.MemberSuspended, + ImprovingApp.MemberContext.MemberTerminated, + ImprovingApp.MemberContext.MemberInfoEdited, + ImprovingApp.MemberContext.MemberData } source MemberEvents is { outlet Events is type PublicMemberEvent @@ -38,7 +38,7 @@ context MemberContext is { briefly "Required - Real last name of the member", //mobileNumber: MobileNumber? briefly "Optional mobile phone number", //emailAddress: EmailAddress? briefly "Optional email address", - notificationPreference: NotificationPreference? + notificationPreference: ImprovingApp.GatewayAPI.MemberGateway.NotificationPreference? briefly "if this is set it is assumed that the user has opted in.", organizationMembership: OrganizationId* briefly "A possibly empty list of organizations this member belongs to.", @@ -61,7 +61,7 @@ context MemberContext is { briefly "Real last name of the member", //mobileNumber: MobileNumber?, //emailAddress: EmailAddress?, - notificationPreference: NotificationPreference? + notificationPreference: ImprovingApp.GatewayAPI.MemberGateway.NotificationPreference? briefly "if this is set it is assumed that the user has opted in.", organizationMembership: OrganizationId* briefly "A list of organizations this member belongs to.", @@ -209,7 +209,7 @@ context MemberContext is { |MetaInfoQuery has matched. } - result MemberListResult is {members: MemberMap} + result MemberListResult is {members: ImprovingApp.MemberContext.MemberMap} briefly "The data returned from the GetMembersByMetaInfo query" described as { |This result contains the MemberMap, which contains all members that @@ -217,21 +217,12 @@ context MemberContext is { } entity Member is { - options(aggregate, technology("akka")) + option aggregate + option technology("akka") handler MemberHandler is { - on command RegisterMember { - morph entity Member to state DraftMemberState with record DraftMember -// ( -// info = @MemberRegistered.info, -// meta = !MemberContext.MetaInfo( -// createdOn = now(), -// createdBy = @RegisterMember.onBehalfOf, -// lastUpdatedOn = now(), -// lastUpdatedBy = @RegisterMember.onBehalfOf, -// currentState = @MemberStates.Draft -// ) -// ) + on command ImprovingApp.GatewayAPI.MemberGateway.RegisterMember { + morph entity ImprovingApp.MemberContext.Member to state DraftMemberState with record DraftMember } //on command RegisterMemberList { @@ -252,39 +243,14 @@ context MemberContext is { } state DraftMemberState of record DraftMember is { handler DraftMemberHandler { - on command RegisterMember { + on command ImprovingApp.MemberContext.RegisterMember { error "Member has already been registered." } - on command ActivateMember { + on command ImprovingApp.MemberContext.ActivateMember { if "all required fields in requiredInfo are not None or Empty" then { send event MemberRegistered to outlet MemberEvents.Events -// ( -// memberId = @DraftMemberState.id, -// info = !MemberContext.EditableInfo( -// contact = @DraftMemberState.info.contact, -// handle = @DraftMemberState.info.handle, -// avatar = @DraftMemberState.info.avatar, -// firstName = @DraftMemberState.info.firstName, -// lastName = @DraftMemberState.info.lastName, -// notificationPreference = @DraftMemberState.info.notificationPreference, -// organizationMembership = @DraftMemberState.info.organizationMembership, -// tenant = @DraftMemberState.info.tenant -// ), -// meta = !MemberContext.MetaInfo( -// createdOn = @DraftMemberState.meta.createdOn, -// createdBy = @DraftMemberState.meta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @EditOrganizationInfo.editingMember, -// currentState = @OrganizationStates.Active -// ) -// ) - morph entity Member to state RegisteredMemberState with - record RegisteredMember -// ( -// info = @DraftMemberState.info, -// orgMeta = @DraftMemberState.meta -// ) + morph entity Member to state RegisteredMemberState with record RegisteredMember } else { if "all required fields in state are not present" then { @@ -293,38 +259,15 @@ context MemberContext is { } } on command EditMemberInfo { - set field DraftMemberState.info to "MemberContext.EditableInfo" -// ( -// contact = @EditMemberInfo.info.contact, -// handle = @EditMemberInfo.info.handle, -// avatar = @EditMemberInfo.info.avatar, -// firstName = @EditMemberInfo.info.firstName, -// lastName = @EditMemberInfo.info.lastName, -// tenant = @EditMemberInfo.info.tenant, -// notificationPreference = @EditMemberInfo.info.notificationPreference, -// organizationMembership = @EditMemberInfo.info.organizationMembership -// ) - set field DraftMemberState.meta to "MemberContext.MetaInfo" -// ( -// createdOn = @DraftMemberState.meta.createdOn, -// createdBy = @DraftMemberState.meta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @EditMemberInfo.editingMember, -// currentState = @MemberStates.Draft -// ) - send event MemberInfoEdited -// ( -// memberId = @DraftMemberState.id, -// info = @DraftMemberState.info, -// meta = @DraftMemberState.meta -// ) - to outlet MemberEvents.Events + set field Member.DraftMemberState.info to "MemberContext.EditableInfo" + set field Member.DraftMemberState.meta to "MemberContext.MetaInfo" + send event MemberInfoEdited to outlet ImprovingApp.MemberContext.MemberEvents.Events } // For GetMemberData, eventually probably only admins and self should be able to make this call. Also // potentially allow other roles to get some limited information (this will require adding another // aggregate). on query GetMemberData { - send record MemberInfo to outlet MemberEvents.Events + send record MemberInfo to outlet ImprovingApp.MemberContext.MemberEvents.Events } } } described as { @@ -345,7 +288,7 @@ context MemberContext is { invariant lastName is ">=(length(@RegisteredMemberState.info.firstName), 3)" handler ActiveMemberHandler { - on command RegisterMember { + on command ImprovingApp.MemberContext.RegisterMember { error "Member has already been registered." } on command EditMemberInfo { @@ -367,113 +310,40 @@ context MemberContext is { lastUpdatedBy = @EditMemberInfo.editingMember, currentState = @MemberStates.Draft )" - send event MemberInfoEdited - // memberId = @DraftMemberState.id, - // info = !MemberContext.Info( - // contact = @RegisteredMemberState.info.contact, - // handle = @RegisteredMemberState.info.handle, - // avatar = @RegisteredMemberState.info.avatar, - // firstName = @RegisteredMemberState.info.firstName, - // lastName = @RegisteredMemberState.info.lastName, - // notificationPreference = @RegisteredMemberState.info.notificationPreference, - // organizationMembership = @RegisteredMemberState.info.organizationMembership, - // tenant = @RegisteredMemberState.info.tenant - // ), - // meta = @RegisteredMemberState.meta) - to outlet MemberEvents.Events + send event MemberInfoEdited to outlet ImprovingApp.MemberContext.MemberEvents.Events } - on command SuspendMember { + on command ImprovingApp.MemberContext.SuspendMember { if "all required fields in requiredInfo are not None or Empty" then { - send event MemberSuspended - // ( - // memberId = @RegisteredMemberState.id, - // info = @RegisteredMemberState.info, - // meta = !MemberContext.MetaInfo( - // createdOn = @RegisteredMemberState.meta.createdOn, - // createdBy = @RegisteredMemberState.meta.createdBy, - // lastUpdatedOn = now(), - // lastUpdatedBy = @SuspendMember.suspendingMember, - // currentState = @MemberStates.Suspended - // ) - to outlet MemberEvents.Events + send event MemberSuspended to outlet MemberEvents.Events become entity Member to handler SuspendedMemberHandler } } - on command TerminateMember { - set field RegisteredMemberState.meta to - "record MemberContext.MetaInfo" - // ( - // createdOn = @RegisteredMemberState.meta, - // createdBy = @RegisteredMemberState.meta, - // lastUpdatedOn = now(), - // lastUpdatedBy = @TerminateMember.terminatingMember, - // currentState = @RegisteredMemberState.meta - // ) - morph entity Member to state TerminatedMember - with record TerminatedMemberState + on command ImprovingApp.MemberContext.TerminateMember { + set field RegisteredMemberState.meta to "record MemberContext.MetaInfo" + morph entity ImprovingApp.MemberContext.Member to state ImprovingApp.MemberContext.Member.TerminatedMember with record TerminatedMemberState } on query GetMemberData { reply record MemberInfo } } handler SuspendedMemberHandler { - on command RegisterMember { + on command ImprovingApp.MemberContext.RegisterMember { error "Member has already been registered." } - on command ActivateMember { - send event MemberActivated - // ( - // memberId = @RegisteredMemberState.id, - // info = @RegisteredMemberState.info, - // meta = !MemberContext.MetaInfo( - // createdOn = @RegisteredMemberState.meta.createdOn, - // createdBy = @RegisteredMemberState.meta.createdBy, - // lastUpdatedOn = now(), - // lastUpdatedBy = @ActivateMember.activatingMember, - // currentState = @MemberStates.Active - // ) - //) - to outlet MemberEvents.Events - become entity Member to handler ActiveMemberHandler + on command ImprovingApp.MemberContext.ActivateMember { + send event ImprovingApp.GatewayAPI.MemberGateway.MemberActivated to outlet ImprovingApp.MemberContext.MemberEvents.Events + become entity ImprovingApp.MemberContext.Member to handler ActiveMemberHandler } - on command SuspendMember { + on command ImprovingApp.MemberContext.SuspendMember { set field RegisteredMemberState.meta to "MemberContext.MetaInfo" - // ( - // createdOn = @RegisteredMemberState.meta.createdOn, - // createdBy = @RegisteredMemberState.meta.createdBy, - // lastUpdatedOn = now(), - // lastUpdatedBy = @SuspendMember.suspendingMember, - // currentState = @MemberStates.Suspended - // ) - send event MemberSuspended - // ( - // memberId = @RegisteredMemberState.id, - // info = @RegisteredMemberState.info, - // meta = !MemberContext.MetaInfo( - // createdOn = @RegisteredMemberState.meta.createdOn, - // createdBy = @RegisteredMemberState.meta.createdBy, - // lastUpdatedOn = now(), - // lastUpdatedBy = @SuspendMember.suspendingMember, - // currentState = @MemberStates.Suspended - // ) - //) - to outlet MemberEvents.Events + send event ImprovingApp.MemberContext.MemberSuspended to outlet ImprovingApp.MemberContext.MemberEvents.Events } briefly "A suspension reason can be updated by re-issuing the command" - on command TerminateMember { + on command ImprovingApp.MemberContext.TerminateMember { set field RegisteredMemberState.meta to "MemberContext.MetaInfo" - // ( - // createdOn = @RegisteredMemberState.meta.createdOn, - // createdBy = @RegisteredMemberState.meta.createdBy, - // lastUpdatedOn = now(), - // lastUpdatedBy = @TerminateMember.terminatingMember, - // currentState = @RegisteredMemberState.meta - // ) - morph entity Member to state TerminatedMember - with record TerminatedMemberState - // (lastMeta = @RegisteredMemberState.meta) + morph entity ImprovingApp.MemberContext.Member to state TerminatedMember with record TerminatedMemberState } on query GetMemberData { - reply record Info + reply record ImprovingApp.MemberContext.Info } } described as { |This state describes that a member cannot access anything due diff --git a/src/main/riddl/MembersAttendingEventsForAnOrganizationProjection/membersAttendingEventsForAnOrganizationProjection.riddl b/src/main/riddl/MembersAttendingEventsForAnOrganizationProjection/membersAttendingEventsForAnOrganizationProjection.riddl index c7c5e70f0..52bb72b65 100644 --- a/src/main/riddl/MembersAttendingEventsForAnOrganizationProjection/membersAttendingEventsForAnOrganizationProjection.riddl +++ b/src/main/riddl/MembersAttendingEventsForAnOrganizationProjection/membersAttendingEventsForAnOrganizationProjection.riddl @@ -1,6 +1,6 @@ query FindMembersAtEventsOnDayForOrg is {org: OrganizationId, eventDate: Date} result NoEventsOnDayForOrg is {org: OrganizationId} -result MembersAtEventsOnDay is {memberEvents: MemberEvents+} +result MembersAtEventsOnDay is {memberEvents: ImprovingApp.MemberEvents+} context MembersAttendingEventsForAnOrganizationProjection is { projector MembersAttendingEventsForAnOrganizationView is { diff --git a/src/main/riddl/Order/Order.riddl b/src/main/riddl/Order/Order.riddl index 53ce5027e..aefea771c 100644 --- a/src/main/riddl/Order/Order.riddl +++ b/src/main/riddl/Order/Order.riddl @@ -24,7 +24,7 @@ context OrderContext is { type OrderMetaInfo is { order_id: OrderId, memberId: MemberId, - storeId: StoreId, + storeId: ImprovingApp.StoreContext.StoreId, createdOn: Date, lastModifiedBy: MemberId, lastModifiedOn: Date @@ -33,7 +33,7 @@ context OrderContext is { lineItems: LineItem*, specialInstructions: String? } - command CreateOrder {orderId: OrderId, storeId: StoreId, info: OrderInfo, creatingMember: MemberId} + command CreateOrder {orderId: OrderId, storeId: ImprovingApp.StoreContext.StoreId, info: OrderInfo, creatingMember: MemberId} event OrderCreated {orderId: OrderId, info: OrderInfo, meta: OrderMetaInfo} command SetToPendingOrder {orderId: OrderId, updatingMember: MemberId} event PendingOrderSet {orderId: OrderId, info: OrderInfo, meta: OrderMetaInfo} @@ -53,7 +53,7 @@ context OrderContext is { event LineItemCancelled {orderId: OrderId, productId: SKU, forMemberId: MemberId} entity Order is { - options (event-sourced) + option event-sourced handler DefaultOrderHandler is { on command CreateOrder { diff --git a/src/main/riddl/Organization/organization.riddl b/src/main/riddl/Organization/organization.riddl index f36af42ea..42ea57131 100644 --- a/src/main/riddl/Organization/organization.riddl +++ b/src/main/riddl/Organization/organization.riddl @@ -7,48 +7,15 @@ context OrganizationContext is { include "organizationsProjection" include "organizationSources" - entity Organization by author Reid is { - options (event-sourced, available) + entity Organization is { + by author Reid + option event-sourced + option available handler OrganizationHandler is { - on command EstablishOrganization { - send event OrganizationEstablished -// ( -// organizationId = @EstablishOrganization.orgId, -// info = @EstablishOrganization.info, -// parent = @EstablishOrganization.parent, -// members = @EstablishOrganization.members, -// owners = @EstablishOrganization.owners, -// contacts = @EstablishOrganization.contacts, -// meta = !OrganizationContext.MetaInfo( -// createdOn = now(), -// createdBy = @EstablishOrganization.establishingMember, -// lastUpdatedOn = now(), -// lastUpdatedBy = @EstablishOrganization.establishingMember, -// currentState = @OrganizationStates.Draft -// ) -// ) - to outlet OrganizationEvents.Events - morph entity Organization to state DraftOrganization with - record DraftOrganizationState -// ( -// info = !OrganizationContext.EditableInfo( -// name = @EstablishOrganization.info.name, -// shortName = @EstablishOrganization.info.shortName, -// address = @EstablishOrganization.info.address, -// isPrivate = @EstablishOrganization.info.isPrivate, -// url = @EstablishOrganization.info.url, -// logo = @EstablishOrganization.info.logo, -// tenant = @EstablishOrganization.info.tenant -// ), -// meta = !OrganizationContext.MetaInfo( -// createdOn = now(), -// createdBy = @EstablishOrganization.establishingMember, -// lastUpdatedOn = now(), -// lastUpdatedBy = @EstablishOrganization.establishingMember, -// currentState = @OrganizationStates.Draft -// ) -// ) + on command ImprovingApp.OrganizationContext.EstablishOrganization { + send event ImprovingApp.OrganizationContext.OrganizationEstablished to outlet OrganizationEvents.Events + morph entity ImprovingApp.OrganizationContext.Organization to state DraftOrganization with record DraftOrganizationState } on other { error "Only EstablishOrganization command is allowed in the default state" @@ -67,43 +34,13 @@ context OrganizationContext is { } state DraftOrganization of DraftOrganizationState is { handler DraftOrganizationHandler is { - on command EstablishOrganization { + on command ImprovingApp.OrganizationContext.EstablishOrganization { error "Organization already established" } on command EditOrganizationInfo { set field DraftOrganizationState.info to "OrganizationContext.Info" -// ( -// name = @EditOrganizationInfo.newInfo.name, -// shortName = @EditOrganizationInfo.newInfo.shortName, -// address = @EditOrganizationInfo.newInfo.address, -// isPrivate = @EditOrganizationInfo.newInfo.isPrivate, -// url = @EditOrganizationInfo.newInfo.url, -// logo = @EditOrganizationInfo.newInfo.logo, -// tenant = @EditOrganizationInfo.newInfo.tenant -// ) set field DraftOrganizationState.orgMeta to "OrganizationContext.MetaInfo" -// ( -// createdOn = @DraftOrganizationState.orgMeta.createdOn, -// createdBy = @DraftOrganizationState.orgMeta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @EditOrganizationInfo.editingMember, -// currentState = @OrganizationStates.Draft -// ) - send event OrganizationInfoEdited -// ( -// organizationId = @DraftOrganizationState.id, -// info = !OrganizationContext.Info( -// name = @DraftOrganizationState.info.name, -// shortName = @DraftOrganizationState.info.shortName, -// address = @DraftOrganizationState.info.address, -// isPrivate = @DraftOrganizationState.info.isPrivate, -// url = @DraftOrganizationState.info.url, -// logo = @DraftOrganizationState.info.logo, -// tenant = @DraftOrganizationState.info.tenant -// ), -// meta = @DraftOrganizationState.orgMeta -// ) - to outlet OrganizationEvents.Events + send event OrganizationInfoEdited to outlet OrganizationEvents.Events } on command UpdateParent { if "successful" then { @@ -223,51 +160,10 @@ context OrganizationContext is { // then error "EditingMember is not authorized to make this change." // } // } - on command activate: ActivateOrganization { + on command ActivateOrganization { if "all required fields in info are not None or Empty and required non-info fields are present" then { - send event OrganizationEstablished -// ( -// organizationId = @DraftOrganizationState.id, -// info = !OrganizationContext.Info( -// name = @activate.info.sss, -// shortName = @DraftOrganizationState.info.shortName, -// address = @DraftOrganizationState.info.address, -// isPrivate = @DraftOrganizationState.info.isPrivate, -// url = @DraftOrganizationState.info.url, -// logo = @DraftOrganizationState.info.logo, -// tenant = @DraftOrganizationState.info.tenant -// ), -// parent = @DraftOrganizationState.parent, -// members = @DraftOrganizationState.members, -// owners = @DraftOrganizationState.owners, -// contacts = @DraftOrganizationState.contacts, -// meta = !OrganizationContext.MetaInfo( -// createdOn = @DraftOrganizationState.orgMeta.createdOn, -// createdBy = @DraftOrganizationState.orgMeta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @EditOrganizationInfo.editingMember, -// currentState = @OrganizationStates.Active -// ) -// ) - to outlet OrganizationEvents.Events - morph entity Organization to state EstablishedOrganization - with record EstablishedOrganizationState -// ( -// info = !OrganizationContext.Info( -// name = @DraftOrganizationState.info.name, -// shortName = @DraftOrganizationState.info.shortName, -// address = @DraftOrganizationState.info.address, -// isPrivate = @DraftOrganizationState.info.isPrivate, -// url = @DraftOrganizationState.info.url, -// logo = @DraftOrganizationState.info.logo, -// tenant = @DraftOrganizationState.info.tenant -// ), -// parent = @DraftOrganizationState.parent, -// members = @DraftOrganizationState.members, -// owners = @DraftOrganizationState.owners, -// contact = @DraftOrganizationState.contact, -// orgMeta = @DraftOrganizationState.orgMeta -// ) + send event OrganizationEstablished to outlet OrganizationEvents.Events + morph entity Organization to state EstablishedOrganization with record EstablishedOrganizationState } else { if "all required fields in state are not present" then { "state is not sufficiently filled out to activate organization" @@ -301,10 +197,6 @@ context OrganizationContext is { } else { if "Owners field is present (non-empty)" then { reply record OrganizationOwners - // ( - // orgId = @DraftOrganizationState.orgId, - // owners = @DraftOrganizationState.owners - // ) } } } @@ -314,24 +206,15 @@ context OrganizationContext is { } else { if "Contacts field is present (non-empty)" then { reply result OrganizationContacts - // ( - // orgId = @DraftOrganizationState.orgId, - // contacts = @DraftOrganizationState.contacts - // ) } } } on query GetOrganizationMeta { reply with result OrganizationMeta - // ( - // orgId = @DraftOrganizationState.orgId, - // metaInfo = @DraftOrganizationState.metaInfo - // ) } on query GetOrganizationState { if "State field is present (non-empty)" then { reply with record OrganizationState - // ( currentState = @DraftOrganizationState.metaInfo.currentState ) } } on other { @@ -352,39 +235,15 @@ context OrganizationContext is { } state EstablishedOrganization of EstablishedOrganizationState is { handler ActiveOrganizationHandler is { - on command EstablishOrganization { + on command ImprovingApp.OrganizationContext.EstablishOrganization { error "Organization already established" } - on command EditOrganizationInfo { + on command ImprovingApp.OrganizationContext.EditOrganizationInfo { set field EstablishedOrganizationState.info to "OrganizationContext.Info" - // ( - // name = @EditOrganizationInfo.newInfo.name, - // shortName = @EditOrganizationInfo.newInfo.shortName, - // address = @EditOrganizationInfo.newInfo.address, - // isPrivate = @EditOrganizationInfo.newInfo.isPrivate, - // url = @EditOrganizationInfo.newInfo.url, - // logo = @EditOrganizationInfo.newInfo.logo, - // tenant = @EditOrganizationInfo.newInfo.tenant - // ) set field EstablishedOrganizationState.orgMeta to "OrganizationContext.MetaInfo" - // ( - // meta = !OrganizationContext.MetaInfo( - // createdOn = @EstablishedOrganizationState.orgMeta.createdOn, - // createdBy = @EstablishedOrganizationState.orgMeta.createdBy, - // lastUpdatedOn = now(), - // lastUpdatedBy = @EditOrganizationInfo.editingMember, - // currentState = @OrganizationStates.Draft - // ) - // ) - send event OrganizationInfoEdited - // ( - // organizationId = @EstablishedOrganizationState.id, - // info = @EstablishedOrganizationState.info, - // meta = @EstablishedOrganizationState.orgMeta - // ) - to outlet OrganizationEvents.Events + send event OrganizationInfoEdited to outlet OrganizationEvents.Events } - on command UpdateParent { + on command ImprovingApp.OrganizationContext.UpdateParent { if "editingMember is not Authorized" then { error "EditingMember is not authorized to make this change." } else { @@ -401,7 +260,7 @@ context OrganizationContext is { } } } - on command AddMembersToOrganization { + on command ImprovingApp.OrganizationContext.AddMembersToOrganization { if "Member does not meet qualifictions to join organization" then { "Place rejected member in dead letter queue and process remaining members" "Consider how to notify of partial success" // TODO: discuss how this might work @@ -424,7 +283,7 @@ context OrganizationContext is { "emit MembersAddedToOrganization event" } } - on command RemoveMembersFromOrganization { + on command ImprovingApp.OrganizationContext.RemoveMembersFromOrganization { if "editingMember is not Authorized" then { error "EditingMember is not authorized to make this change." stop @@ -434,7 +293,7 @@ context OrganizationContext is { "yield MembersRemovedFromOrganization()"// TODO } } - on command AddOwnersToOrganization { + on command ImprovingApp.OrganizationContext.AddOwnersToOrganization { if "Member in ownersToAdd is not in memberList of organizationId" then { "Place non-member owner in dead letter queue and finish processing remaining member owners" "Consider how to notify of partial success" // TODO: discuss how this might work @@ -459,7 +318,7 @@ context OrganizationContext is { "emit OwnersAddedToOrganization event" } } - on command RemoveOwnersFromOrganization { + on command ImprovingApp.OrganizationContext.RemoveOwnersFromOrganization { if "editingMember is not Authorized" then { error "EditingMember is not authorized to make this change." } else { @@ -468,7 +327,7 @@ context OrganizationContext is { "yield OwnersRemovedFromOrganization()"// TODO } } - on command UpdateOrganizationContacts { + on command ImprovingApp.OrganizationContext.UpdateOrganizationContacts { if "Member in contactsToAdd is not in memberList of organizationId" then { "Place non-member contact in dead letter queue and finish processing remaining member contacts" "Consider how to notify of partial success" // TODO: discuss how this might work @@ -499,186 +358,83 @@ context OrganizationContext is { // then error "EditingMember is not authorized to make this change." // } // } - on command SuspendOrganization { + on command ImprovingApp.OrganizationContext.SuspendOrganization { set field EstablishedOrganizationState.orgMeta to "OrganizationContext.MetaInfo" -// ( -// createdOn = @DraftOrganizationState.orgMeta.createdOn, -// createdBy = @DraftOrganizationState.orgMeta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @SuspendOrganization.suspendingMember, -// currentState = @OrganizationStates.Suspended -// ) - send event OrganizationSuspended -// ( -// organizationId = @EstablishedOrganizationState.id, -// meta = @EstablishedOrganizationState.orgMeta -// ) - to outlet OrganizationEvents.Events - become entity Organization to handler SuspendedOrganizationHandler + send event OrganizationSuspended to outlet OrganizationEvents.Events + become entity ImprovingApp.OrganizationContext.Organization to handler SuspendedOrganizationHandler } - on command TerminateOrganization { + on command ImprovingApp.OrganizationContext.TerminateOrganization { set field EstablishedOrganizationState.orgMeta to "OrganizationContext.MetaInfo" -// ( -// createdOn = @DraftOrganizationState.orgMeta.createdOn, -// createdBy = @DraftOrganizationState.orgMeta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @TerminateOrganization.terminatingMember, -// currentState = @DraftOrganizationState.orgMeta -// ) - morph entity Organization to state TerminatedOrganization + morph entity ImprovingApp.OrganizationContext.Organization to state ImprovingApp.OrganizationContext.Organization.TerminatedOrganization with record TerminatedOrganizationState //(lastMeta = @EstablishedOrganizationState.orgMeta) } on query GetOrganizationInfo { reply result OrganizationInfo -// ( -// orgId = @DraftOrganizationState.orgId, -// info = @DraftOrganizationState.info -// ) } on query GetOrganizationParent { reply result OrganizationParent -// ( -// orgId = @DraftOrganizationState.orgId, -// parent = @DraftOrganizationState.parent -// ) } on query GetOrganizationMembers { reply result OrganizationMembers -// ( -// orgId = @DraftOrganizationState.orgId, -// members = @DraftOrganizationState.members -// ) } on query GetOrganizationOwners { reply result OrganizationOwners -// ( -// orgId = @DraftOrganizationState.orgId, -// owners = @DraftOrganizationState.owners -// ) } on query GetOrganizationContacts { reply result OrganizationContacts -// ( -// orgId = @DraftOrganizationState.orgId, -// contacts = @DraftOrganizationState.contacts -// ) } on query GetOrganizationMeta { reply result OrganizationMeta -// ( -// orgId = @DraftOrganizationState.orgId, -// metaInfo = @DraftOrganizationState.metaInfo -// ) } on query GetOrganizationState { reply result OrganizationState -// ( -// currentState = @DraftOrganizationState.metaInfo.currentState -// ) } on other { error "No other commands allowed in Active state" } } handler SuspendedOrganizationHandler is { - on command EstablishOrganization { + on command ImprovingApp.OrganizationContext.EstablishOrganization { error "Organization already established" } on command ActivateOrganization { set field EstablishedOrganizationState.orgMeta to "OrganizationContext.MetaInfo" -// ( -// createdOn = @DraftOrganizationState.orgMeta.createdOn, -// createdBy = @DraftOrganizationState.orgMeta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @ActivateOrganization.activatingMember, -// currentState = @OrganizationStates.Active -// ) send event OrganizationActivated -// ( -// organizationId = @EstablishedOrganizationState.id, -// meta = @EstablishedOrganizationState.orgMeta -// ) to outlet OrganizationEvents.Events - become entity Organization to handler ActiveOrganizationHandler + become entity ImprovingApp.OrganizationContext.Organization + to handler ActiveOrganizationHandler } on command SuspendOrganization { set field EstablishedOrganizationState.orgMeta to "OrganizationContext.MetaInfo" -// ( -// createdOn = @DraftOrganizationState.orgMeta.createdOn, -// createdBy = @DraftOrganizationState.orgMeta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @SuspendOrganization.suspendingMember, -// currentState = @OrganizationStates.Suspended -// ) - send event OrganizationSuspended -// ( -// organizationId = @EstablishedOrganizationState.id, -// meta = @EstablishedOrganizationState.orgMeta -// ) - to outlet OrganizationEvents.Events - become entity Organization to handler SuspendedOrganizationHandler + send event OrganizationSuspended to outlet OrganizationEvents.Events + become entity ImprovingApp.OrganizationContext.Organization to handler SuspendedOrganizationHandler } briefly "A suspension reason can be updated by re-issuing the command" on command TerminateOrganization { set field EstablishedOrganizationState.orgMeta to "OrganizationContext.MetaInfo" -// ( -// createdOn = @DraftOrganizationState.orgMeta.createdOn, -// createdBy = @DraftOrganizationState.orgMeta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @TerminateOrganization.terminatingMember, -// currentState = @OrganizationStates.Suspended -// ) - morph entity Organization to state TerminatedOrganization - with record TerminatedOrganizationState - // (lastMeta = @EstablishedOrganizationState.orgMeta) + morph entity ImprovingApp.OrganizationContext.Organization to + state ImprovingApp.OrganizationContext.Organization.TerminatedOrganization with record TerminatedOrganizationState } on query GetOrganizationInfo { reply result OrganizationInfo -// ( -// orgId = @DraftOrganizationState.orgId, -// info = @DraftOrganizationState.info -// ) } on query GetOrganizationParent { reply result OrganizationParent -// ( -// orgId = @DraftOrganizationState.orgId, -// parent = @DraftOrganizationState.parent -// ) } on query GetOrganizationMembers { reply result OrganizationMembers -// ( -// orgId = @DraftOrganizationState.orgId, -// members = @DraftOrganizationState.members -// ) } on query GetOrganizationOwners { reply result OrganizationOwners -// ( -// orgId = @DraftOrganizationState.orgId, -// owners = @DraftOrganizationState.owners -// ) } on query GetOrganizationContacts { reply result OrganizationContacts -// ( -// orgId = @DraftOrganizationState.orgId, -// contacts = @DraftOrganizationState.contacts -// ) } on query GetOrganizationMeta { reply result OrganizationMeta -// ( -// orgId = @DraftOrganizationState.orgId, -// metaInfo = @DraftOrganizationState.metaInfo -// ) } on query GetOrganizationState { reply result OrganizationState -// ( -// currentState = @DraftOrganizationState.metaInfo.currentState -// ) } on other { error "Move organization to the Active state in order to edit details about organization." diff --git a/src/main/riddl/Organization/organizationMessages.riddl b/src/main/riddl/Organization/organizationMessages.riddl index 81be8dfbd..b1c5acbdf 100644 --- a/src/main/riddl/Organization/organizationMessages.riddl +++ b/src/main/riddl/Organization/organizationMessages.riddl @@ -2,7 +2,7 @@ command EstablishOrganization is { orgId: OrganizationId, info: OrganizationContext.Info briefly "Details about an organization required for it to exist. See OrganizationContext.Organization.Info for details.", tenant: TenantId, - parent: Parent?, + parent: ImprovingApp.OrganizationContext.Parent?, members: MemberList, owners: OwnerList, contacts: ContactList, @@ -13,7 +13,7 @@ described in file "establishOrganization.md" event OrganizationEstablished is { organizationId: OrganizationId briefly "Unique identifier returned by EstablishOrganization command", info: OrganizationContext.Info, - parent: Parent?, + parent: ImprovingApp.OrganizationContext.Parent?, members: MemberList, owners: OwnerList, contacts: ContactList, diff --git a/src/main/riddl/Organization/organizationSources.riddl b/src/main/riddl/Organization/organizationSources.riddl index 496e51361..d7bf9a543 100644 --- a/src/main/riddl/Organization/organizationSources.riddl +++ b/src/main/riddl/Organization/organizationSources.riddl @@ -1,13 +1,13 @@ type PublicOrganizationEvent is one of { - OrganizationEstablished, - OrganizationActivated, - OrganizationSuspended, - OrganizationTerminated, - OrganizationInfoEdited, - MembersAddedToOrganization, - OwnersAddedToOrganization, - OrganizationContactsUpdated, - OrganizationAccountsUpdated + ImprovingApp.OrganizationContext.OrganizationEstablished, + ImprovingApp.OrganizationContext.OrganizationActivated, + ImprovingApp.OrganizationContext.OrganizationSuspended, + ImprovingApp.OrganizationContext.OrganizationTerminated, + ImprovingApp.OrganizationContext.OrganizationInfoEdited, + ImprovingApp.OrganizationContext.MembersAddedToOrganization, + ImprovingApp.OrganizationContext.OwnersAddedToOrganization, + ImprovingApp.OrganizationContext.OrganizationContactsUpdated, + ImprovingApp.OrganizationContext.OrganizationAccountsUpdated } source OrganizationEvents is { diff --git a/src/main/riddl/Organization/organizationStories.riddl b/src/main/riddl/Organization/organizationStories.riddl index 66ff2bc6b..70cba0278 100644 --- a/src/main/riddl/Organization/organizationStories.riddl +++ b/src/main/riddl/Organization/organizationStories.riddl @@ -1,6 +1,6 @@ user Owner is "the person that owns the organization" -story EstablishOrganization is { +epic EstablishOrganization is { term Organization briefly "An organizational unit, incorporated or not. " case primary is { step from user Owner "creates an Organization" to diff --git a/src/main/riddl/Organization/organizationsProjection.riddl b/src/main/riddl/Organization/organizationsProjection.riddl index 9f4745c79..4d5e15277 100644 --- a/src/main/riddl/Organization/organizationsProjection.riddl +++ b/src/main/riddl/Organization/organizationsProjection.riddl @@ -1,11 +1,11 @@ projector OrganizationsView is { record Fields { orgId: ImprovingApp.OrganizationId, //org-owner & org-member correlation tables - orgOwner: ImprovingApp.MemberId, //org-owner correlation table - orgMember: ImprovingAPp.MemberId //org-member correlation table + orgOwner: MemberId, //org-owner correlation table + orgMember: MemberId //org-member correlation table } handler OrganizationsView is { - on event OrganizationEstablished { + on event ImprovingApp.OrganizationContext.OrganizationEstablished { "create row in org table with orgId set to OrganizationEstablished.info.orgId" "and set previous row's orgName to OrganizationEstablished.info.name" "and set previous row's orgInfo to OrganizationEstablished.info" diff --git a/src/main/riddl/OrganizationsForMembersAttendingEventsProjection/organizationsForMembersAttendingEventsProjection.riddl b/src/main/riddl/OrganizationsForMembersAttendingEventsProjection/organizationsForMembersAttendingEventsProjection.riddl index 3bc5e5df9..d16a7764c 100644 --- a/src/main/riddl/OrganizationsForMembersAttendingEventsProjection/organizationsForMembersAttendingEventsProjection.riddl +++ b/src/main/riddl/OrganizationsForMembersAttendingEventsProjection/organizationsForMembersAttendingEventsProjection.riddl @@ -16,7 +16,7 @@ context OrganizationsForMembersAttendingEventsProjections is { attendingMemberName: String //member table } handler OrganizationsForMembersAttendingEventsViewHandler is { - on event OrganizationEstablished { + on event ImprovingApp.OrganizationContext.OrganizationEstablished { "create row in org table with orgId set to OrganizationEstablished.info.orgId" "set row's attendingMemberOrgName to OrganizationEstablished.info.name" } diff --git a/src/main/riddl/Product/product.riddl b/src/main/riddl/Product/product.riddl index 2ebf2a9c2..5d3ab4c55 100644 --- a/src/main/riddl/Product/product.riddl +++ b/src/main/riddl/Product/product.riddl @@ -13,7 +13,7 @@ context ProductContext is { type ProductDetails is any of {TicketDetails} type ProductStatus is any of {Draft, Active, InActive, Deleted} briefly "Note: Delete is not the same as in Org, Tenant, etc because there is no PII. Here it is more like Terminate" - type SKU is Id(Product) + type SKU is Id(ProductContext.Product) type TicketDetails is one of {ReservedTicket, RestrictedTicket, OpenTicket} type ReservedTicket is { @@ -36,7 +36,7 @@ context ProductContext is { image: String*, price: Number briefly "Required for non-Draft state", cost: Number briefly "Required for non-Draft state", - store: StoreId briefly "Required for non-Draft state" + store: StoreContext.StoreId briefly "Required for non-Draft state" } type ProductInfoUpdate is { name: String?, @@ -45,7 +45,7 @@ context ProductContext is { image: String*, price: Number?, cost: Number?, - store: StoreId? + store: StoreContext.StoreId? } type ProductMetaInfo is { createdBy: MemberId, @@ -53,10 +53,10 @@ context ProductContext is { lastModifiedBy: MemberId, lastModifiedOn: Date } - command CreateProduct is {sku: SKU, info: ProductInfo, onBehalfOf: MemberId} - event ProductCreated is {sku: SKU, info: ProductInfo, meta: ProductMetaInfo} - command UpdateProductInfo is {sku: SKU, info: ProductInfoUpdate, onBehalfOf: MemberId} - event ProductInfoUpdated is {sku: SKU, info: ProductInfo, meta: ProductMetaInfo} + command CreateProduct is {sku: SKU, info: ProductContext.ProductInfo, onBehalfOf: MemberId} + event ProductCreated is {sku: SKU, info: ProductContext.ProductInfo, meta: ProductMetaInfo} + command UpdateProductInfo is {sku: SKU, info: ProductContext.ProductInfoUpdate, onBehalfOf: MemberId} + event ProductInfoUpdated is {sku: SKU, info: ProductContext.ProductInfo, meta: ProductMetaInfo} command DeleteProduct is {sku: SKU, onBehalfOf: MemberId} event ProductDeleted is {sku: SKU} command ActivateProduct is {sku: SKU, onBehalfOf: MemberId} @@ -64,26 +64,15 @@ context ProductContext is { command InactivateProduct is {sku: SKU, onBehalfOf: MemberId} event ProductInactivated is {sku: SKU} query GetProductInfo is {sku: SKU} - result ProductInfoResult is {info: ProductInfo, meta: ProductMetaInfo} + result ProductInfoResult is {info: ProductContext.ProductInfo, meta: ProductContext.ProductMetaInfo} query GetTicketsForEvent is {event: EventId} //TODO: Move this query/result to a projector? result TicketsForEvent is {event: EventId, tickets: SKU*} entity Product is { - options (event-sourced) + option event-sourced handler ProductHandler is { - on command CreateProduct { - morph entity Product to state DraftProductState with record DraftProduct -// ( -// sku = @CreateProduct.sku, -// info = @CreatProduct.info, -// meta = !MemberContext.MetaInfo( -// createdOn = now(), -// createdBy = @CreatProduct.onBehalfOf, -// lastUpdatedOn = now(), -// lastUpdatedBy = @CreatProduct.onBehalfOf, -// currentState = @ProductStates.Draft -// ) -// ) + on command ProductContext.CreateProduct { + morph entity ProductContext.Product to state DraftProductState with record DraftProduct } on other { error "Only the CreateProduct command is allowed in the default state." @@ -92,12 +81,12 @@ context ProductContext is { record DraftProduct is { sku: SKU, - info: ProductInfo, + info: ProductContext.ProductInfo, meta: ProductMetaInfo } state DraftProductState of Product.DraftProduct is { handler CreatedProductHandler is { - on command CreateProduct { + on command ProductContext.CreateProduct { error "Product already created." } on command UpdateProductInfo{ @@ -107,26 +96,9 @@ context ProductContext is { } on command DeleteProduct{ set field DraftProductState.meta to "ProductContext.ProductMetaInfo" -// ( -// createdOn = @DraftProductState.meta.createdOn, -// createdBy = @DraftProductState.meta.createdBy, -// lastUpdated = now(), -// lastUpdatedBy = @DeleteProduct.onBehalfOf, -// currentState = @ProductStates.Deleted -// ) send event ProductDeleted -// ( -// sku = @DraftProductState.sku, -// info = @DraftProductState.info, -// meta = @DraftProductState.meta -// ) to outlet ProductEvents.Events - morph entity Product to state DeletedProductState with record DeletedProduct -// ( -// sku = @DraftProductState.sku, -// name = @DraftProductState.info.name, -// lastMeta = @DraftProductState.meta -// ) + morph entity ProductContext.Product to state DeletedProductState with record DeletedProduct } on command ActivateProduct{ if "not all required fields are filled in" then { @@ -134,39 +106,8 @@ context ProductContext is { } else { // "all required fields are present" set field DraftProductState.meta to "ProductContext.ProductMetaInfo" -// ( -// createdOn = @DraftProductState.meta.createdOn, -// createdBy = @DraftProductState.meta.createdBy, -// lastUpdated = now(), -// lastUpdatedBy = @ActivateProduct.onBehalfOf, -// currentState = @ProductStates.Active -// ) - send event ProductActivated -// ( -// sku = @DraftProductState.sku, -// info = @DraftProductState.info, -// meta = @DraftProductState.meta -// ) - to outlet ProductEvents.Events + send event ProductActivated to outlet ProductEvents.Events morph entity Product to state DefinedProductState with record DefinedProduct -// ( -// info = !ProductInfo( -// name = @DraftProductState.info.name, -// description = @DraftProductState.info.description, -// products = @DraftProductState.info.products, -// event = @DraftProductState.info.event, -// venue = @DraftProductState.info.venue, -// location = @DraftProductState.info.location, -// sponsoringOrg = @DraftProductState.info.sponsoringOrg -// ), -// meta = !ProductContext.MetaInfo( -// createdOn = @DraftProductState.meta.createdOn, -// createdBy = @DraftProductState.meta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @ActivateProduct.updatingMember, -// currentState = @ProductStates.Active -// ) -// ) } } on command InactivateProduct{ @@ -180,118 +121,56 @@ context ProductContext is { record DefinedProduct is { sku: SKU, - info: ProductInfo, - meta: ProductMetaInfo + info: ProductContext.ProductInfo, + meta: ProductContext.ProductMetaInfo } state DefinedProductState of Product.DefinedProduct is { handler ActiveProductHandler is { - on command CreateProduct { + on command ProductContext.CreateProduct { error "Product already created." } - on command UpdateProductInfo{ + on command ProductContext.UpdateProductInfo{ "Copy fields that are provided from UpdateProductInfo.info into DefinedProductState.info fields" "adjust meta fields to reflect the change set" "yield ProductInfoUpdated event with new info" } - on command DeleteProduct{ + on command ProductContext.DeleteProduct{ set field DefinedProductState.meta to "ProductContext.ProductMetaInfo" -// ( -// createdOn = @DefinedProductState.meta.createdOn, -// createdBy = @DefinedProductState.meta.createdBy, -// lastUpdated = now(), -// lastUpdatedBy = @DeleteProduct.onBehalfOf, -// currentState = @ProductStates.Deleted -// ) - send event ProductDeleted -// ( -// sku = @DefinedProductState.sku, -// info = @DefinedProductState.info, -// meta = @DefinedProductState.meta -// ) - to outlet ProductEvents.Events - morph entity Product to state DeletedProductState with record DeletedProduct -// ( -// sku = @DefinedProductState.sku, -// name = @DefinedProductState.info.name, -// lastMeta = @DefinedProductState.meta -// ) + send event ProductDeleted to outlet ProductEvents.Events + morph entity ProductContext.Product to state DeletedProductState with record DeletedProduct } - on command ActivateProduct{ + on command ProductContext.ActivateProduct{ error "Product is already active" } - on command InactivateProduct { + on command ProductContext.InactivateProduct { set field DefinedProductState.meta to "ProductContext.ProductMetaInfo" -// ( -// createdOn = @DefinedProductState.meta.createdOn, -// createdBy = @DefinedProductState.meta.createdBy, -// lastUpdated = now(), -// lastUpdatedBy = @InactivateProduct.onBehalfOf, -// currentState = @ProductStates.Inactive -// ) - send event ProductInactivated -// ( -// sku = @DefinedProductState.sku, -// info = @DefinedProductState.info, -// meta = @DefinedProductState.meta -// ) - to outlet ProductEvents.Events - become entity Product to handler InactiveProductHandler + send event ProductInactivated to outlet ProductEvents.Events + become entity ProductContext.Product to handler Product.DefinedProductState.InactiveProductHandler } on query GetProductInfo{ "yield ProductInfoResult message" } } handler InactiveProductHandler is { - on command CreateProduct { + on command ProductContext.CreateProduct { error "Product already created." } - on command UpdateProductInfo{ + on command ProductContext.UpdateProductInfo{ "Copy fields that are provided from UpdateProductInfo.info into DefinedProductState.info fields" "adjust meta fields to reflect the change set" "yield ProductInfoUpdated event with new info" } - on command DeleteProduct{ + on command ProductContext.DeleteProduct{ set field DefinedProductState.meta to "ProductContext.ProductMetaInfo" -// ( -// createdOn = @DefinedProductState.meta.createdOn, -// createdBy = @DefinedProductState.meta.createdBy, -// lastUpdated = now(), -// lastUpdatedBy = @DeleteProduct.onBehalfOf, -// currentState = @ProductStates.Deleted -// ) - send event ProductDeleted -// ( -// sku = @DefinedProductState.sku, -// info = @DefinedProductState.info, -// meta = @DefinedProductState.meta -// ) - to outlet ProductEvents.Events - morph entity Product to state DeletedProductState with record DeletedProduct -// ( -// sku = @DefinedProductState.sku, -// name = @DefinedProductState.info.name, -// lastMeta = @DefinedProductState.meta -// ) + send event ProductDeleted to outlet ProductEvents.Events + morph entity ProductContext.Product to state ProductContext.Product.DeletedProductState with record DeletedProduct } - on command ActivateProduct{ + on command ProductContext.ActivateProduct{ set field DefinedProductState.meta to "ProductContext.ProductMetaInfo" -// ( -// createdOn = @DefinedProductState.meta.createdOn, -// createdBy = @DefinedProductState.meta.createdBy, -// lastUpdated = now(), -// lastUpdatedBy = @ActivateProduct.onBehalfOf, -// currentState = @ProductStates.Active -// ) - send event ProductActivated -// ( -// sku = @DefinedProductState.sku, -// info = @DefinedProductState.info, -// meta = @DefinedProductState.meta -// ) - to outlet ProductEvents.Events - become entity Product to handler ActiveProductHandler + send event ProductActivated to outlet ProductEvents.Events + become entity ProductContext.Product to handler Product.DefinedProductState.ActiveProductHandler } - on command InactivateProduct{ + on command ProductContext.InactivateProduct{ error "Product is already Inactive" } on query GetProductInfo{ @@ -306,19 +185,19 @@ context ProductContext is { } state DeletedProductState of Product.DeletedProduct is { handler DeletedProductHandler is { - on command CreateProduct { + on command ProductContext.CreateProduct { error "Product already created." } - on command UpdateProductInfo{ + on command ProductContext.UpdateProductInfo{ error "Cannot update a Deleted product" } - on command DeleteProduct{ + on command ProductContext.DeleteProduct{ error "Product already deleted" } - on command ActivateProduct{ + on command ProductContext.ActivateProduct{ error "Cannot activate a deleted product. Consider creating a new product instead." } - on command InactivateProduct{ + on command ProductContext.InactivateProduct{ error "Cannot inactivate a Deleted product." } on query GetProductInfo{ diff --git a/src/main/riddl/Relationships/relationships.riddl b/src/main/riddl/Relationships/relationships.riddl index 1a41b3b18..3b41811f6 100644 --- a/src/main/riddl/Relationships/relationships.riddl +++ b/src/main/riddl/Relationships/relationships.riddl @@ -39,7 +39,7 @@ context Relationships is { //from organization.riddl //from event.riddl - eventStores: StoreId* //TODO: Do we want the association of Event<->Store here or on Store? + eventStores: StoreContext.StoreId* //TODO: Do we want the association of Event<->Store here or on Store? participatingOrgs: OrganizationId*, supportingOrgs: OrganizationId*, } diff --git a/src/main/riddl/Store/Store.riddl b/src/main/riddl/Store/Store.riddl index cc0f13af4..d2cd01571 100644 --- a/src/main/riddl/Store/Store.riddl +++ b/src/main/riddl/Store/Store.riddl @@ -23,7 +23,7 @@ context StoreContext is { products: SKU+ briefly "Required", event: EventId?, venue: VenueId briefly "Required", - location: LocationId briefly "Required", + location: Venues.LocationId briefly "Required", sponsoringOrg: OrganizationId briefly "Required" } @@ -41,76 +41,56 @@ context StoreContext is { products: SKU*, event: EventId?, venue: VenueId?, - location: LocationId?, + location: Venues.LocationId?, sponsoringOrg: OrganizationId? } - command CreateStore is {storeId: StoreId, info: StoreContext.EditableInfo, creatingMember: MemberId} - event StoreCreated is {storeId: StoreId, info: StoreContext.EditableInfo, meta: StoreContext.MetaInfo} - command EditStoreInfo is {storeId: StoreId, info: StoreContext.EditableInfo, updatingMember: MemberId} - event StoreInfoEdited {storeId: StoreId, info: StoreContext.Info, meta: StoreContext.MetaInfo} - command MakeStoreReady is {storeId: StoreId, updatingMember: MemberId} - event StoreIsReady is {storeId: StoreId, meta: StoreContext.MetaInfo} - command DeleteStore is {storeId: StoreId, deletingMember: MemberId} - event StoreDeleted is {storeId: StoreId, meta: StoreContext.MetaInfo} - command OpenStore is {storeId: StoreId, openingMember: MemberId} - event StoreOpened is {storeId: StoreId, info: StoreContext.Info, meta: StoreContext.MetaInfo} - command CloseStore is {storeId: StoreId, closingMember: MemberId} - event StoreClosed is {storeId: StoreId, info: StoreContext.Info, meta: StoreContext.MetaInfo} - command TerminateStore is {storeId: StoreId, terminatingMember: MemberId} - event StoreTerminated is {storeId: StoreId, lastMeta: StoreContext.MetaInfo} - command AddProductsToStore is {storeId: StoreId, products: SKU+, addingMember: MemberId} - event ProductsAddedToStore is {storeId: StoreId, info: StoreContext.Info, meta: StoreContext.MetaInfo} - command RemoveProductsFromStore is {storeId: StoreId, product: SKU+, removingMember: MemberId} - event ProductsRemovedFromStore is {storeId: StoreId, info: StoreContext.Info, meta: StoreContext.MetaInfo} + command CreateStore is {storeId: StoreContext.StoreId, info: StoreContext.EditableInfo, creatingMember: MemberId} + event StoreCreated is {storeId: StoreContext.StoreId, info: StoreContext.EditableInfo, meta: StoreContext.MetaInfo} + command EditStoreInfo is {storeId: StoreContext.StoreId, info: StoreContext.EditableInfo, updatingMember: MemberId} + event StoreInfoEdited {storeId: StoreContext.StoreId, info: StoreContext.Info, meta: StoreContext.MetaInfo} + command MakeStoreReady is {storeId: StoreContext.StoreId, updatingMember: MemberId} + event StoreIsReady is {storeId: StoreContext.StoreId, meta: StoreContext.MetaInfo} + command DeleteStore is {storeId: StoreContext.StoreId, deletingMember: MemberId} + event StoreDeleted is {storeId: StoreContext.StoreId, meta: StoreContext.MetaInfo} + command OpenStore is {storeId: StoreContext.StoreId, openingMember: MemberId} + event StoreOpened is {storeId: StoreContext.StoreId, info: StoreContext.Info, meta: StoreContext.MetaInfo} + command CloseStore is {storeId: StoreContext.StoreId, closingMember: MemberId} + event StoreClosed is {storeId: StoreContext.StoreId, info: StoreContext.Info, meta: StoreContext.MetaInfo} + command TerminateStore is {storeId: StoreContext.StoreId, terminatingMember: MemberId} + event StoreTerminated is {storeId: StoreContext.StoreId, lastMeta: StoreContext.MetaInfo} + command AddProductsToStore is {storeId: StoreContext.StoreId, products: SKU+, addingMember: MemberId} + event ProductsAddedToStore is {storeId: StoreContext.StoreId, info: StoreContext.Info, meta: StoreContext.MetaInfo} + command RemoveProductsFromStore is {storeId: StoreContext.StoreId, product: SKU+, removingMember: MemberId} + event ProductsRemovedFromStore is {storeId: StoreContext.StoreId, info: StoreContext.Info, meta: StoreContext.MetaInfo} //command IncrementProductInventory is {???} //TODO: Should we pull in the Nike Inventory demo that Sean built? //command DecrementProductInventory is {???} query GetStoreInfo is {???} result StoreInfoResult is {???} - query GetProductsInStore is {store: StoreId} + query GetProductsInStore is {store: StoreContext.StoreId} result ProductsInStore is {products: SKU*} entity Store is { - options (event-sourced, available) + option event-sourced + option available handler DefaultStoreHandler is { on command CreateStore { send event StoreCreated -// ( -// storeId = @CreateStore.storeId, -// info = @CreateStore.info, -// meta = !StoreContext.MetaInfo( -// createdOn = now(), -// createdBy = @CreateStore.creatingMember, -// lastUpdatedOn = now(), -// lastUpdatedBy = @CreateStore.creatingMember, -// currentState = @CreateStore.Draft -// ) -// ) to outlet StoreEvents.Events - morph entity Store to state DraftStore with record DraftStoreState -// ( -// info = @CreateStore.info, -// meta = !StoreContext.MetaInfo( -// createdOn = now(), -// createdBy = @CreateStore.creatingMember, -// lastUpdatedOn = now(), -// lastUpdatedBy = @CreateStore.creatingMember, -// currentState = @StoreStates.Draft -// ) -// ) + morph entity StoreContext.Store to state Store.DraftStore with record Store.DraftStoreData } on other { error "Only the CreateStore command is allowed in the default state" } } - record DraftStoreState is { - id: StoreId, + record DraftStoreData is { + id: StoreContext.StoreId, info: StoreContext.EditableInfo, meta: StoreContext.MetaInfo } - state DraftStore of DraftStoreState is { + state DraftStore of Store.DraftStoreData is { handler DraftStoreHandler is { on command CreateStore { error "Store already created" @@ -124,49 +104,17 @@ context StoreContext is { "remove all attributes not defined in the Deleted state" "adjust meta fields to reflect change" "yield the StoreDeleted event" - morph entity Store to state DeletedStore with record DeletedStoreState -// ( -// storeName = @DraftStoreState.info.storeName, -// event = @DraftStoreState.optionalInfo, -// venue = @DraftStoreState.requiredInfo, -// location = @DraftStoreState.requiredInfo, -// sponsoringOrg = @DraftStoreState.requiredInfo, -// meta = !StoreContext.MetaInfo( -// createdOn = @DraftStoreState.meta.createdOn, -// createdBy = @DraftStoreState.meta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @DeleteStore.deletingMember, -// currentState = @StoreStates.Deleted -// ) -// ) + morph entity StoreContext.Store to state DeletedStore with record DeletedStoreData } on command MakeStoreReady { "yield the StoreIsReady event" - morph entity Store to state CreatedStore with record CreatedStoreState -// ( -// info = !StoreContext.Info( -// name = @DraftStoreState.requiredInfo, -// description = @DraftStoreState.optionalInfo, -// products = @DraftStoreState.requiredInfo, -// event = @DraftStoreState.requiredInfo, -// venue = @DraftStoreState.requiredInfo, -// location = @DraftStoreState.requiredInfo, -// sponsoringOrg = @DraftStoreState.requiredInfo -// ), -// meta = !StoreContext.MetaInfo( -// createdOn = @DraftStoreState.meta.createdOn, -// createdBy = @DraftStoreState.meta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @MakeStoreReady.updatingMember, -// currentState = @StoreStates.Ready -// ) -// ) + morph entity StoreContext.Store to state CreatedStore with record CreatedStoreData } on command OpenStore { error "store must be moved to the Ready state. All required attributes must be provided." } on command CloseStore { - error "A store in Draft state may not be closed" + error "A store in Draft state may not be closed" // FIXME: Really? Why not? } on command AddProductsToStore { "add provided products to store definition" @@ -183,12 +131,12 @@ context StoreContext is { } } - record CreatedStoreState is { - id: StoreId, + record CreatedStoreData is { + id: StoreContext.StoreId, info: StoreContext.Info, meta: StoreContext.MetaInfo } - state CreatedStore of CreatedStoreState is { + state CreatedStore of CreatedStoreData is { handler ReadyStoreHandler is { on command CreateStore { error "Store already created" @@ -205,41 +153,15 @@ context StoreContext is { error "Store must be in Draft state before being made Ready" } on command OpenStore { - set field CreatedStoreState.meta to "StoreContext.MetaInfo" -// ( -// createdOn = @CreatedStoreState.meta.createdOn, -// createdBy = @CreatedStoreState.meta.createdBy, -// lastUpdated = now(), -// lastUpdatedBy = @OpenStore.openingMember, -// currentState = @StoreStates.Open -// ) - send event StoreOpened -// ( -// storeId = @CreatedStoreState.id, -// info = @CreatedStoreState.info, -// meta = @CreatedStoreState.meta -// ) - to outlet StoreEvents.Events - become entity Store to handler OpenStoreHandler + set field Store.CreatedStore.meta to "StoreContext.MetaInfo" + send event StoreOpened to outlet StoreEvents.Events + become entity StoreContext.Store to handler StoreContext.Store.CreatedStore.OpenStoreHandler } on command CloseStore { "ensure all orders associated with store are Delivered or Cancelled before closing store" - set field CreatedStoreState.meta to "StoreContext.MetaInfo" -// ( -// createdOn = @CreatedStoreState.meta, -// createdBy = @CreatedStoreState.meta, -// lastUpdated = now(), -// lastUpdatedBy = @CloseStore.closingMember, -// currentState = @StoreStates.Closed -// ) - send event StoreClosed -// ( -// storeId = @CreatedStoreState.id, -// info = @CreatedStoreState.info, -// meta = @CreatedStoreState.meta -// ) - to outlet StoreEvents.Events - become entity Store to handler ClosedStoreHandler + set field CreatedStore.meta to "StoreContext.MetaInfo" + send event StoreClosed to outlet StoreEvents.Events + become entity StoreContext.Store to handler StoreContext.Store.CreatedStore.ClosedStoreHandler } on command AddProductsToStore { "add provided products to store definition" @@ -254,15 +176,8 @@ context StoreContext is { // TODO: Add case where product to be removed doesn't exist in store } on command TerminateStore { - set field CreatedStoreState.meta to "StoreContext.MetaInfo" -// ( -// createdOn = @CreatedStoreState.meta.createdOn, -// createdBy = @CreatedStoreState.meta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @TerminateStore.terminatingMember, -// currentState = @CreatedStoreState.meta -// ) - morph entity Store to state TerminatedStore with record TerminatedStoreState + set field CreatedStore.meta to "StoreContext.MetaInfo" + morph entity StoreContext.Store to state TerminatedStore with record TerminatedStoreData // (lastMeta = @CreatedStoreState.meta) } } @@ -287,22 +202,9 @@ context StoreContext is { } on command CloseStore { "ensure all orders associated with store are Delivered or Cancelled before closing store" - set field CreatedStoreState.meta to "StoreContext.MetaInfo" -// ( -// createdOn = @CreatedStoreState.meta.createdOn, -// createdBy = @CreatedStoreState.meta.createdBy, -// lastUpdated = now(), -// lastUpdatedBy = @CloseStore.closingMember, -// currentState = @StoreStates.Closed -// ) - send event StoreClosed -// ( -// storeId = @CreatedStoreState.id, -// info = @CreatedStoreState.info, -// meta = @CreatedStoreState.meta -// ) - to outlet StoreEvents.Events - become entity Store to handler ClosedStoreHandler + set field CreatedStore.meta to "StoreContext.MetaInfo" + send event StoreClosed to outlet StoreEvents.Events + become entity StoreContext.Store to handler StoreContext.Store.CreatedStore.ClosedStoreHandler } on command AddProductsToStore { "add provided products to store definition" @@ -317,15 +219,8 @@ context StoreContext is { // TODO: Add case where product to be removed doesn't exist in store } on command TerminateStore { - set field CreatedStoreState.meta to "StoreContext.MetaInfo" -// ( -// createdOn = @CreatedStoreState.meta.createdOn, -// createdBy = @CreatedStoreState.meta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @TerminateStore.terminatingMember, -// currentState = @CreatedStoreState.meta -// ) - morph entity Store to state TerminatedStore with record TerminatedStoreState + set field CreatedStore.meta to "StoreContext.MetaInfo" + morph entity StoreContext.Store to state TerminatedStore with record TerminatedStoreData // (lastMeta = @CreatedStoreState.meta) } } @@ -343,48 +238,14 @@ context StoreContext is { error "Store must be in Draft state before being made Ready" } on command DeleteStore { - set field CreatedStoreState.meta to "StoreContext.MetaInfo" -// ( -// createdOn = @CreatedStoreState.meta.createdOn, -// createdBy = @CreatedStoreState.meta.createdBy, -// lastUpdated = now(), -// lastUpdatedBy = @DeleteStore.deletingMember, -// currentState = @StoreStates.Deleted -// ) - send event StoreDeleted -// ( -// storeId = @CreatedStoreState.id, -// info = @CreatedStoreState.info, -// meta = @CreatedStoreState.meta -// ) - to outlet StoreEvents.Events - morph entity Store to state DeletedStore with record DeletedStoreState -// ( -// storeName = @CreatedStoreState.info.storeName, -// event = @CreatedStoreState.info.event, -// venue = @CreatedStoreState.info.venue, -// location = @CreatedStoreState.info.location, -// sponsoringOrg = @CreatedStoreState.info.sponsoringOrg, -// meta = @CreatedStoreState.meta -// ) + set field CreatedStore.meta to "StoreContext.MetaInfo" + send event StoreDeleted to outlet StoreEvents.Events + morph entity StoreContext.Store to state DeletedStore with record DeletedStoreData } on command OpenStore { - set field CreatedStoreState.meta to "StoreContext.MetaInfo" -// ( -// createdOn = @CreatedStoreState.meta.createdOn, -// createdBy = @CreatedStoreState.meta.createdBy, -// lastUpdated = now(), -// lastUpdatedBy = @OpenStore.openingMember, -// currentState = @StoreStates.Open -// ) - send event StoreOpened -// ( -// storeId = @CreatedStoreState.id, -// info = @CreatedStoreState.info, -// meta = @CreatedStoreState.meta -// ) - to outlet StoreEvents.Events - become entity Store to handler OpenStoreHandler + set field CreatedStore.meta to "StoreContext.MetaInfo" + send event StoreOpened to outlet StoreEvents.Events + become entity StoreContext.Store to handler Store.CreatedStore.OpenStoreHandler } on command CloseStore { error "Store is already closed." @@ -402,40 +263,26 @@ context StoreContext is { // TODO: Add case where product to be removed doesn't exist in store } on command TerminateStore { - set field CreatedStoreState.meta to "StoreContext.MetaInfo" -// ( -// createdOn = @CreatedStoreState.meta.createdOn, -// createdBy = @CreatedStoreState.meta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @TerminateStore.terminatingMember, -// currentState = @CreatedStoreState.meta -// ) - morph entity Store to state TerminatedStore with record TerminatedStoreState + set field CreatedStore.meta to "StoreContext.MetaInfo" + morph entity StoreContext.Store to state TerminatedStore with record TerminatedStoreData // (lastMeta = @CreatedStoreState.meta) } } } - record DeletedStoreState is { + record DeletedStoreData is { storeName: String, event: EventId?, venue: VenueId, - location: LocationId, + location: Venues.LocationId, sponsoringOrg: OrganizationId, meta: StoreContext.MetaInfo } - state DeletedStore of DeletedStoreState is { + state DeletedStore of DeletedStoreData is { handler DeletedStoreHandler is { on command TerminateStore { - set field DeletedStoreState.meta to "StoreContext.MetaInfo" -// ( -// createdOn = @DeletedStoreState.meta.createdOn, -// createdBy = @DeletedStoreState.meta.createdBy, -// lastUpdatedOn = now(), -// lastUpdatedBy = @TerminateStore.terminatingMember, -// currentState = @DeletedStoreState.meta -// ) - morph entity Store to state TerminatedStore with record TerminatedStoreState + set field DeletedStore.meta to "StoreContext.MetaInfo" + morph entity StoreContext.Store to state TerminatedStore with record TerminatedStoreData // (lastMeta = @DeletedStoreState.meta) } on other { @@ -444,10 +291,10 @@ context StoreContext is { } } - record TerminatedStoreState is { + record TerminatedStoreData is { lastMeta: StoreContext.MetaInfo } - state TerminatedStore of TerminatedStoreState is { + state TerminatedStore of TerminatedStoreData is { handler TerminatedStoreHandler is { on other { error "No actions are permitted on a Terminated store" diff --git a/src/main/riddl/Tenant/tenant.riddl b/src/main/riddl/Tenant/tenant.riddl index 3f269e8c1..bdf09820b 100644 --- a/src/main/riddl/Tenant/tenant.riddl +++ b/src/main/riddl/Tenant/tenant.riddl @@ -8,7 +8,8 @@ context TenantContext is { include "tenantSources" entity Tenant is { - options (event-sourced, available) + option event-sourced + option available handler TenantHandler is { on command EstablishTenant { @@ -18,28 +19,9 @@ context TenantContext is { if "primaryContact info is not complete" then { error "primaryContact must be complete in order to establish a Tenant" } else { - send event TenantEstablished -// ( -// tenantId = @EstablishTenant.tenantId, -// tenantInfo = @EstablishTenant.tenantInfo, -// metaInfo = !TenantContext.TenantMetaInfo( -// createdOn = now(), -// createdBy = @EstablishTenant.establishingMember, -// lastUpdatedOn = now(), -// lastUpdatedBy = @EstablishTenant.establishingMember, -// currentState = @TenantStates.Active -// ) -// ) - to outlet TenantEvents.Events + send event TenantEstablished to outlet TenantEvents.Events morph entity Tenant to state EstablishedTenant with record EstablishedTenantState -// ( -// createdOn = now(), -// createdBy = @EstablishTenant.establishingMember, -// lastUpdatedOn = now(), -// lastUpdatedBy = @EstablishTenant.establishingMember, -// currentState = @TenantStates.Active -// ) } } } @@ -172,20 +154,7 @@ context TenantContext is { on command TenantContext.EditInfo { "Copy fields which are present from TenantContext.EditInfo.newInfo into info fields" set field EstablishedTenantState.meta to "record TenantContext.TenantMetaInfo" -// ( -// createdOn = @EstablishedTenantState.meta, -// createdBy = @EstablishedTenantState.meta, -// lastUpdated = now(), -// lastUpdatedBy = @TenantContext.EditInfo.suspendingUser, -// currentState = @EstablishedTenantState.meta -// ) send event TenantContext.InfoEdited -// ( -// tenantId = @EstablishedTenantState.id, -// oldInfo = @EstablishedTenantState.info, -// newInfo = @EstablishedTenantState.info, // copied object from above -// meta = @EstablishedTenantState.meta -// ) to outlet TenantEvents.Events } on command SuspendTenant { @@ -193,20 +162,7 @@ context TenantContext is { error "User is not authorized to suspend Tenant" } else { set field EstablishedTenantState.meta to "record TenantContext.TenantMetaInfo" -// ( -// createdOn = @EstablishedTenantState.meta, -// createdBy = @EstablishedTenantState.meta, -// lastUpdated = now(), -// lastUpdatedBy = @SuspendTenant.suspendingUser, -// currentState = @TenantStates.Suspended -// ) - send event TenantContext.TenantSuspended -// ( -// tenantId = @EstablishedTenantState.id, -// info = @EstablishedTenantState.info, -// meta = @EstablishedTenantState.meta -// ) - to outlet TenantEvents.Events + send event TenantContext.TenantSuspended to outlet TenantEvents.Events become entity Tenant to handler SuspendedTenantHandler } } @@ -215,19 +171,7 @@ context TenantContext is { error "User is not authorized to modify Tenant" } else { set field EstablishedTenantState.meta to "TenantContext.TenantMetaInfo" -// ( -// createdOn = @EstablishedTenantState.meta, -// createdBy = @EstablishedTenantState.meta, -// lastUpdated = now(), -// lastUpdatedBy = @TerminateTenant.terminatingUser, -// currentState = @EstablishedTenantState.meta -// ) - send event TenantContext.TenantTerminated -// ( -// tenantId = @EstablishedTenantState.id, -// meta = @EstablishedTenantState.meta -// ) - to outlet TenantEvents.Events + send event TenantContext.TenantTerminated to outlet TenantEvents.Events morph entity Tenant to state TerminatedTenant with record TerminatedTenantState } } @@ -270,20 +214,7 @@ context TenantContext is { on command TenantContext.EditInfo { "Copy fields which are present from TenantContext.EditInfo.newInfo into info fields" set field EstablishedTenantState.meta to "TenantContext.TenantMetaInfo" -// ( -// createdOn = @EstablishedTenantState.meta, -// createdBy = @EstablishedTenantState.meta, -// lastUpdated = now(), -// lastUpdatedBy = @TenantContext.EditInfo.suspendingUser, -// currentState = @EstablishedTenantState.meta -// ) send event TenantContext.InfoEdited -// ( -// tenantId = @EstablishedTenantState.id, -// oldInfo = @EstablishedTenantState.info, -// newInfo = @EstablishedTenantState.info, // copied object from above -// meta = @EstablishedTenantState.meta -// ) to outlet TenantEvents.Events } on command ActivateTenant { @@ -291,13 +222,6 @@ context TenantContext is { error "User is not authorized to Activate Tenant" } else { set field EstablishedTenantState.meta to "TenantContext.TenantMetaInfo" -// ( -// createdOn = @EstablishedTenantState.meta, -// createdBy = @EstablishedTenantState.meta, -// lastUpdated = now(), -// lastUpdatedBy = @ActivateTenant.activatingUser, -// currentState = @TenantStates.Active -// ) send event TenantContext.TenantSuspended to outlet TenantEvents.Events become entity Tenant to handler ActiveTenantHandler } @@ -307,18 +231,7 @@ context TenantContext is { error "User is not authorized to modify Tenant" } else { // set field EstablishedTenantState.meta to "TenantContext.TenantMetaInfo" -// ( -// createdOn = @EstablishedTenantState.meta, -// createdBy = @EstablishedTenantState.meta, -// lastUpdated = now(), -// lastUpdatedBy = @TerminateTenant.terminatingUser, -// currentState = @EstablishedTenantState.meta -// ) send event TenantContext.TenantTerminated -// ( -// tenantId = @EstablishedTenantState.id, -// meta = @EstablishedTenantState.meta -// ) to outlet TenantEvents.Events morph entity Tenant to state TerminatedTenant with record TerminatedTenantState } diff --git a/src/main/riddl/Tenant/tenantProjections.riddl b/src/main/riddl/Tenant/tenantProjections.riddl index af81636d8..7610c81e4 100644 --- a/src/main/riddl/Tenant/tenantProjections.riddl +++ b/src/main/riddl/Tenant/tenantProjections.riddl @@ -3,7 +3,7 @@ result TenantByName is { tenants: TenantId, info: TenantContext.TenantInfo } -result NoTenantWithName {} +result NoTenantWithName { ??? } projector TenantViews is { record TenantFields { diff --git a/src/main/riddl/Tenant/tenantStories.riddl b/src/main/riddl/Tenant/tenantStories.riddl index 23e42691a..681e56d95 100644 --- a/src/main/riddl/Tenant/tenantStories.riddl +++ b/src/main/riddl/Tenant/tenantStories.riddl @@ -1,6 +1,6 @@ -user ResponsibleParty is "the person that is financially responsible for the Tenant and all activity that happens under the Tenant" +ResponsibleParty is "the person that is financially responsible for the Tenant and all activity that happens under the Tenant" -story EstablishTenant is { +epic EstablishTenant is { As a ResponsibleParty, I would like "establish an new Tenant", so I can "I can leverage the capabilities Improving.App to benefit my organization (business/school/etc.)" term Tenant briefly "The financially responsible entity for an organization's use of Improving.App." case HappyPath is { diff --git a/src/main/riddl/Tenant/tenantTypeDefinitions.riddl b/src/main/riddl/Tenant/tenantTypeDefinitions.riddl index 0cda8b51c..10acb866e 100644 --- a/src/main/riddl/Tenant/tenantTypeDefinitions.riddl +++ b/src/main/riddl/Tenant/tenantTypeDefinitions.riddl @@ -2,7 +2,7 @@ type OptionalInfo is { name: String?, primaryContact: Contact?, address: Address?, - orgs: Organization* + orgs: ImprovingApp.OrganizationId* } briefly "Information about the tenant" type TenantInfo is { diff --git a/src/main/riddl/Vendors/vendor.riddl b/src/main/riddl/Vendors/vendor.riddl index 584fbd8a9..14740e97b 100644 --- a/src/main/riddl/Vendors/vendor.riddl +++ b/src/main/riddl/Vendors/vendor.riddl @@ -1,7 +1,7 @@ context Vendor is { - type StoreId is Id( Store ) - type CatalogId is Id( Catalog ) - type CategoryId is Id( Category ) + type StoreId is Id( Vendor.Store ) + type CatalogId is Id( Vendor.Catalog ) + type CategoryId is Id( Vendor.Category ) type ProductId is Id( Vendor.Product ) type VendorId is Id( Vendor.Vendor ) @@ -37,7 +37,7 @@ context Vendor is { vendorId: VendorId, vendorInfo: VendorInfo } - state Draft of ^DraftState is { + state Draft of Vendor.DraftState is { handler DraftVendor is {???} } @@ -45,53 +45,53 @@ context Vendor is { vendorId: VendorId, vendorInfo: VendorInfo } - state Active of ^ActiveState is { + state Active of Vendor.ActiveState is { handler ActiveVendorHandler is {???} } record InactiveState is { vendorId: VendorId, vendorInfo: VendorInfo } - state Inactive of ^InactiveState is { + state Inactive of Vendor.InactiveState is { handler InactiveVendor is {???} } record SuspendedState is { vendorId: VendorId, vendorInfo: VendorInfo } - state Suspended of ^SuspendedState is { + state Suspended of Vendor.SuspendedState is { handler SuspendedVendorHandler is {???} } record TerminatedState is { vendorId: VendorId } - state Terminated of ^TerminatedState is { + state Terminated of TerminatedState is { handler TerminatedVendor is {???} } } entity Store is { record StagedState is { - storeId: StoreId, + storeId: StoreContext.StoreId, storeInfo: StoreInfo } - state Staged of ^StagedState is { + state Staged of StagedState is { handler StagedStoreHandler is {???} } record OpenState is { - storeId: StoreId, + storeId: StoreContext.StoreId, storeInfo: StoreInfo } - state Open of ^OpenState is { + state Open of Vendor.Store.OpenState is { handler OpenStoreHandler is {???} } record ClosedState { - storeId: StoreId, + storeId: StoreContext.StoreId, storeInfo: StoreInfo } - state Closed of ^ClosedState is { + state Closed of Vendor.Store.ClosedState is { handler ClosedStoreHandler is {???} } } @@ -112,7 +112,7 @@ context Vendor is { name: String, products: ProductId+ } - state Category of ^CategoryState is { + state Category of CategoryState is { handler CategoryHandler is {???} } } @@ -120,21 +120,21 @@ context Vendor is { record ActiveState is { sku: String, - productInfo: ProductInfo + productInfo: Vendor.ProductInfo //kits i.e. combo meal - future scope //condiments - catsup, mustard, jalapenos, etc. - future scope } - state Active of ^ActiveState is { + state Active of Vendor.Product.ActiveState is { handler ActiveProductHandler is {???} } record InactiveState is { sku: String, - productInfo: ProductInfo + productInfo: ImprovingApp.Vendor.ProductInfo //kits i.e. combo meal //condiments - catsup, mustard, jalapenos, etc. } - state Inactive of ^InactiveState is { + state Inactive of ImprovingApp.Vendor.Product.InactiveState is { handler InactiveProductHandler is {???} } } diff --git a/src/main/riddl/Venues/Locations/location.riddl b/src/main/riddl/Venues/Locations/location.riddl index 54749f170..c2eda7896 100644 --- a/src/main/riddl/Venues/Locations/location.riddl +++ b/src/main/riddl/Venues/Locations/location.riddl @@ -1,4 +1,4 @@ -type LocationId is Id (ImprovingApp.Venues.LocationContext.Location) +type LocationId is Id (Venues.LocationContext.Location) briefly "Unique identifier for Location Entity" context LocationContext is { @@ -6,7 +6,8 @@ context LocationContext is { include "locationMessages" entity Location is { - options (event-sourced, available) + option event-sourced + option available handler LocationHandler is { on command EstablishLocation { @@ -21,19 +22,19 @@ context LocationContext is { } record DraftState is { - locationInfo: LocationContext.Info, - locationMeta: LocationContext.MetaInfo + locationInfo: ImprovingApp.Venues.LocationContext.Info, + locationMeta: ImprovingApp.Venues.LocationContext.MetaInfo } state Draft of Location.DraftState is { handler DraftLocation is { - on command EstablishLocation { + on command ImprovingApp.Venues.LocationContext.EstablishLocation { error "Location already established" } - on command EditLocationInfo { + on command ImprovingApp.Venues.LocationContext.EditLocationInfo { "set Draft info fields to EditLocationInfo.info" "yield event LocationInfoUpdated" } - on command UpdateLocationStatus { + on command ImprovingApp.Venues.LocationContext.UpdateLocationStatus { "morph Location to the state provided in UpdateVenueStatus" "set MetaInfo to capture change data" "yield event VenueInfoUpdated" @@ -49,19 +50,19 @@ context LocationContext is { } record OpenState is { - locationInfo: LocationContext.Info, - locationMeta: LocationContext.MetaInfo + locationInfo: ImprovingApp.Venues.LocationContext.Info, + locationMeta: ImprovingApp.Venues.LocationContext.MetaInfo } state Open of Location.OpenState is { handler OpenLocation is { - on command EstablishLocation { + on command ImprovingApp.Venues.LocationContext.EstablishLocation { error "Location already established" } - on command EditLocationInfo { + on command ImprovingApp.Venues.LocationContext.EditLocationInfo { "set OnHold info fields to EditLocationInfo.info" "yield event LocationInfoUpdated" } - on command UpdateLocationStatus { + on command ImprovingApp.Venues.LocationContext.UpdateLocationStatus { "morph Location to the state provided in UpdateLocationStatus" "set MetaInfo to capture change data" "yield event LocationStatusUpdated" @@ -70,19 +71,19 @@ context LocationContext is { } record ClosedState is { - locationInfo: LocationContext.Info, - locationMeta: LocationContext.MetaInfo + locationInfo: ImprovingApp.Venues.LocationContext.Info, + locationMeta: ImprovingApp.Venues.LocationContext.MetaInfo } state Closed of Location.ClosedState is { handler ClosedLocation is { - on command EstablishLocation { + on command ImprovingApp.Venues.LocationContext.EstablishLocation { error "Location already established" } - on command EditLocationInfo { + on command ImprovingApp.Venues.LocationContext.EditLocationInfo { "set OnHold info fields to EditLocationInfo.info" "yield event LocationInfoUpdated" } - on command UpdateLocationStatus { + on command ImprovingApp.Venues.LocationContext.UpdateLocationStatus { "morph Location to the state provided in UpdateLocationStatus" "set MetaInfo to capture change data" "yield event LocationStatusUpdated" diff --git a/src/main/riddl/Venues/Locations/locationMessages.riddl b/src/main/riddl/Venues/Locations/locationMessages.riddl index 5ca84361b..64b16ac5f 100644 --- a/src/main/riddl/Venues/Locations/locationMessages.riddl +++ b/src/main/riddl/Venues/Locations/locationMessages.riddl @@ -1,5 +1,5 @@ command EstablishLocation is { - locationId: LocationId briefly "A unique identifier for this Location. This must be provided by the calling client.", + locationId: Venues.LocationId, name: String, description: String, directions: String, @@ -13,75 +13,75 @@ command EstablishLocation is { } briefly "Creates a Location with all top-level fields, potentially without Locations" event LocationEstablished is { - locationId: LocationId, - locationInfo: LocationContext.Info, + locationId: Venues.LocationId, + locationInfo: Venues.LocationContext.Info, reservations: ReservationId*, - meta: LocationContext.MetaInfo + meta: Venues.LocationContext.MetaInfo } command AddLocationReservations is { - locationId: LocationId, + locationId: Venues.LocationId, reservations: ReservationId+ } event LocationReservationsAdded is { - locationId: LocationId, + locationId: Venues.LocationId, allReservations: ReservationId+ } command UpdateLocationStatus is { - locationId: LocationId, - status: LocationContext.Status, + locationId: Venues.LocationId, + status: Venues.LocationContext.Status, updatingMember: MemberId } event LocationStatusUpdated is { - locationId: LocationId, - newStatus: LocationContext.Status + locationId: Venues.LocationId, + newStatus: Venues.LocationContext.Status } command EditLocationInfo is { - locationId: LocationId briefly "The unique Id of the location to create", - newInfo: LocationContext.UpdateInfo briefly "The information about the location", + locationId: Venues.LocationId briefly "The unique Id of the location to create", + newInfo: Venues.LocationContext.UpdateInfo briefly "The information about the location", editingMember: MemberId briefly "Id of the member who is creating the location" } briefly "A command to edit the values of an Reservation's Info " event LocationInfoUpdated is { - locationId: LocationId, - info: LocationContext.Info, - meta: LocationContext.MetaInfo + locationId: Venues.LocationId, + info: Venues.LocationContext.Info, + meta: Venues.LocationContext.MetaInfo } query GetNextLocationReservations is { - locationId: LocationId, + locationId: Venues.LocationId, maxCount: Integer, startDate: DateTime? briefly "Used as start date of query when present instead of now()" } query GetLocationReservations is { - venueId: LocationId, - ranges: TimeRange+ + venueId: Venues.LocationId, + ranges: ImprovingApp.TimeRange+ } result LocationReservations is { - venueId: LocationId, + venueId: Venues.LocationId, schedule: ReservationId* briefly "All reservation that take place in the location within the time range (for GetNextLocationReservations) or maxCount+startDate (for GetLocationReservations) provided" } query GetNextLocationAvailability is { - locationId: LocationId, + locationId: Venues.LocationId, maxCount: Integer, startDate: DateTime? briefly "Used as start date of query when present instead of now()" } result LocationAvailabilityCalendar is { - locationId: LocationId, - schedule: TimeRange* briefly "A list of time ranges indicating availability" + locationId: Venues.LocationId, + schedule: ImprovingApp.TimeRange* briefly "A list of time ranges indicating availability" } -query FindAvailableLocationsInRange is {locationId: LocationId, start: Date, end: Date} -query FindAvailableLocationsInRangeWithAmenities is {locationId: LocationId, start: Date, end: Date, desiredAmenities: String*} +query FindAvailableLocationsInRange is {locationId: Venues.LocationId, start: Date, end: Date} +query FindAvailableLocationsInRangeWithAmenities is {locationId: Venues.LocationId, start: Date, end: Date, desiredAmenities: String*} query GetLocationVenue is { - locationId: LocationId + locationId: Venues.LocationId } result LocationVenue is { - locationId: LocationId, + locationId: Venues.LocationId, venueId: VenueId -} \ No newline at end of file +} diff --git a/src/main/riddl/Venues/Locations/locationTypeDefinitions.riddl b/src/main/riddl/Venues/Locations/locationTypeDefinitions.riddl index e58609b78..c5e4e91be 100644 --- a/src/main/riddl/Venues/Locations/locationTypeDefinitions.riddl +++ b/src/main/riddl/Venues/Locations/locationTypeDefinitions.riddl @@ -1,7 +1,7 @@ type Status is any of {Draft, Open, Closed} briefly "Internal status of a Location." type Info is { - id: LocationId, + id: Venues.LocationId, venueId: VenueId, name: String, description: String, @@ -34,6 +34,6 @@ type MetaInfo is { createdBy: MemberId briefly "The member who created this venue", lastUpdated: TimeStamp briefly "The Date/Time this venue was last modified.", lastUpdatedBy: MemberId briefly "The member who last modified this venue. This may also be a system user. i.e. they are two months late on payment so the system determines to suspend the venue.", - currentStatus: LocationContext.Status briefly "The current state of this venue. Valid states include Draft, Active, Suspended, and Terminated", + currentStatus: Venues.LocationContext.Status briefly "The current state of this venue. Valid states include Draft, Active, Suspended, and Terminated", currentOwner: MemberId } briefly "Meta data kept about a location that the user does not directly modify. Instead the system updates this info as a Member Owner updates details in the Info type." diff --git a/src/main/riddl/Venues/venueContext.riddl b/src/main/riddl/Venues/venueContext.riddl index 0413f6205..1d27ecef9 100644 --- a/src/main/riddl/Venues/venueContext.riddl +++ b/src/main/riddl/Venues/venueContext.riddl @@ -7,7 +7,8 @@ context VenueContext is { include "venueProjections" entity Venue is { - options (event-sourced, available) + option event-sourced + option available handler VenueHandler is { on command EstablishVenue { @@ -23,7 +24,7 @@ context VenueContext is { record DraftState is { venueInfo: VenueContext.Info, - locations: LocationId*, + locations: Venues.LocationId*, venueMeta: VenueContext.MetaInfo } state Draft of Venue.DraftState is { @@ -50,7 +51,7 @@ context VenueContext is { record OpenState is { venueInfo: VenueContext.Info, - locations: LocationId*, + locations: Venues.LocationId*, venueMeta: VenueContext.MetaInfo } state Open of Venue.OpenState is { @@ -77,7 +78,7 @@ context VenueContext is { record ClosedState is { orgId: OrganizationId, - locations: LocationId*, + locations: Venues.LocationId*, venueMeta: VenueContext.MetaInfo } state Closed of Venue.ClosedState is { diff --git a/src/main/riddl/Venues/venueLocationsMessages.riddl b/src/main/riddl/Venues/venueLocationsMessages.riddl index 879b4469b..61eda3c7f 100644 --- a/src/main/riddl/Venues/venueLocationsMessages.riddl +++ b/src/main/riddl/Venues/venueLocationsMessages.riddl @@ -4,5 +4,5 @@ query GetLocationsForVenue { } result LocationsForVenue { venueId: VenueId, - location: LocationId+ + location: Venues.LocationId+ } diff --git a/src/main/riddl/Venues/venueLocationsProjections.riddl b/src/main/riddl/Venues/venueLocationsProjections.riddl index ea93d4256..f543c874b 100644 --- a/src/main/riddl/Venues/venueLocationsProjections.riddl +++ b/src/main/riddl/Venues/venueLocationsProjections.riddl @@ -1,7 +1,7 @@ projector VenueLocationsReservationsView is { record Fields { venueId: VenueId, - locationId: LocationId + Venues.locationId: LocationId } handler VenueLocationsViewHandler is { on event VenueEstablished { diff --git a/src/main/riddl/Venues/venueLocationsReservationsMessages.riddl b/src/main/riddl/Venues/venueLocationsReservationsMessages.riddl index 5172f42cc..85e16ee20 100644 --- a/src/main/riddl/Venues/venueLocationsReservationsMessages.riddl +++ b/src/main/riddl/Venues/venueLocationsReservationsMessages.riddl @@ -6,7 +6,7 @@ query GetNextVenueReservations is { } query GetVenueReservationsInRange is { venueId: VenueId, - range: TimeRange+ + range: ImprovingApp.TimeRange+ } result VenueReservations is { venueId: VenueId, @@ -25,32 +25,32 @@ result VenueAvailabilityCalendar is { schedule: VenueAvailabilitySchedule* briefly "A list of location with time ranges indicating availability" } -//based on LocationId +//based on Venus.LocationId query GetNextLocationReservations is { - locationId: LocationId, + locationId: Venues.LocationId, maxCount: Integer, startDate: TimeStamp? briefly "Used as start date of query when present instead of now()" } query GetLocationReservations is { - venueId: LocationId, - ranges: TimeRange+ + venueId: Venues.LocationId, + ranges: ImprovingApp.TimeRange+ } result LocationReservations is { - venueId: LocationId, + venueId: Venues.LocationId, schedule: ReservationId* briefly "All reservation that take place in the location within the time range (for GetNextLocationReservations) or maxCount+startDate (for GetLocationReservations) provided" } query GetNextLocationAvailability is { - locationId: LocationId, + locationId: Venues.LocationId, maxCount: Integer, startDate: TimeStamp? briefly "Used as start date of query when present instead of now()" } result LocationAvailabilityCalendar is { - locationId: LocationId, - schedule: TimeRange* briefly "A list of time ranges indicating availability" + locationId: Venues.LocationId, + schedule: ImprovingApp.TimeRange* briefly "A list of time ranges indicating availability" } -query FindAvailableLocationsInDateRange is {locationId: LocationId, start: Date, end: Date} -query FindAvailableLocationsInDateRangeWithAmenities is {locationId: LocationId, start: Date, end: Date, desiredAmenities: String*} +query FindAvailableLocationsInDateRange is {locationId: Venues.LocationId, start: Date, end: Date} +query FindAvailableLocationsInDateRangeWithAmenities is {locationId: Venues.LocationId, start: Date, end: Date, desiredAmenities: String*} diff --git a/src/main/riddl/Venues/venueLocationsReservationsProjections.riddl b/src/main/riddl/Venues/venueLocationsReservationsProjections.riddl index 1f04d47ac..6c4eaae7c 100644 --- a/src/main/riddl/Venues/venueLocationsReservationsProjections.riddl +++ b/src/main/riddl/Venues/venueLocationsReservationsProjections.riddl @@ -1,7 +1,7 @@ projector VenueLocationsReservationsView is { record Fields { venueId: VenueId, - locationId: LocationId, + locationId: Venues.LocationId, reservationId: ReservationId, reservationStart: TimeStamp, reservationEnd: TimeStamp diff --git a/src/main/riddl/Venues/venueMessages.riddl b/src/main/riddl/Venues/venueMessages.riddl index 73c425844..04a733ad0 100644 --- a/src/main/riddl/Venues/venueMessages.riddl +++ b/src/main/riddl/Venues/venueMessages.riddl @@ -35,11 +35,11 @@ event VenueStatusUpdated is { command AddVenueLocations is { venueId: VenueId, - locations: LocationId+ + locations: Venues.LocationId+ } event VenueLocationsAdded is { venueId: VenueId, - locations: LocationId+ + locations: Venues.LocationId+ } query GetNextVenueReservations is { @@ -49,7 +49,7 @@ query GetNextVenueReservations is { } query GetVenueReservations is { venueId: VenueId, - range: TimeRange+ + range: ImprovingApp.TimeRange+ } result VenueReservations is { venueId: VenueId, @@ -93,10 +93,10 @@ result VenueCapacityOverview is { //types type VenueReservationsSchedule is { - locationId: LocationId, + locationId: Venues.LocationId, reservations: ReservationId+ } type VenueAvailabilitySchedule is { - locationId: LocationId, - schedule: TimeRange+ + locationId: Venues.LocationId, + schedule: ImprovingApp.TimeRange+ } diff --git a/src/main/riddl/Venues/venueTypeDefinitions.riddl b/src/main/riddl/Venues/venueTypeDefinitions.riddl index 7178071b2..3d0de0632 100644 --- a/src/main/riddl/Venues/venueTypeDefinitions.riddl +++ b/src/main/riddl/Venues/venueTypeDefinitions.riddl @@ -15,12 +15,12 @@ type UpdateInfo is { } //type VenueReservationsSchedule is { -// locationId: LocationId, +// locationId: Venues.LocationId, // reservations: ReservationId+ //} // //type VenueAvailabilitySchedule is { -// locationId: LocationId, +// locationId: Venues.LocationId, // schedule: TimeRange+ //} diff --git a/src/main/riddl/authors.riddl b/src/main/riddl/authors.riddl index 8a8fd573a..8750cfbd4 100644 --- a/src/main/riddl/authors.riddl +++ b/src/main/riddl/authors.riddl @@ -1,4 +1,3 @@ -// Author Section author James is { name is "James Lovell" email is "info@yoppworks.com" diff --git a/src/main/riddl/stories.riddl b/src/main/riddl/stories.riddl index 56ab76e18..9a9e972b2 100644 --- a/src/main/riddl/stories.riddl +++ b/src/main/riddl/stories.riddl @@ -1,15 +1,15 @@ -story SetBillingAccountForOrganization is { +epic SetBillingAccountForOrganization is { role is "Owner" capability is "Ensure that root organization has a billing account" benefit is "So that Improving.App can bill for services to the Organization" shown by https://some.url.com - creating a root organization without BillingAccount {} - creating a root organization with a BillingAccount {} - creating a sub organization with a BillingAccount {} - creating a sub organization without a BillingAccount{} + creating a root organization without BillingAccount { ??? } + creating a root organization with a BillingAccount { ??? } + creating a sub organization with a BillingAccount { ??? } + creating a sub organization without a BillingAccount{ ??? } } -story WritingABook is { +epic WritingABook is { role is "Author" capability is "edit on the screen" benefit is "revise content more easily" diff --git a/src/main/riddl/test/TestGateway.riddl b/src/main/riddl/test/TestGateway.riddl index c5b19a748..7b3571ab6 100644 --- a/src/main/riddl/test/TestGateway.riddl +++ b/src/main/riddl/test/TestGateway.riddl @@ -1,8 +1,9 @@ -context TestGateway by author Reid is { +context TestGateway is { option gateway + by author Reid include "messages" - include "handler" + // include "handler" } briefly "A gateway for testing Improving.app instances" explained as { | The messages sent to this service will create various entities. This is diff --git a/src/main/riddl/test/handler.riddl b/src/main/riddl/test/handler.riddl deleted file mode 100644 index 8dfdbd62e..000000000 --- a/src/main/riddl/test/handler.riddl +++ /dev/null @@ -1,13 +0,0 @@ -handler TestGateway is { - on command TestGateway.CreateScenario { - if "no scenario is currently running" then { - "create all the entities as defined in the CreateScenario command" - } - } - - on command TestGateway.RunScenario { - if "CreateScenario has been called and each of the TenantInfo values provided in CreateTenants" then { - "create a tenant with matching content, 0 members, and 0 organizations" - } - } -} diff --git a/src/main/riddl/test/messages.riddl b/src/main/riddl/test/messages.riddl index 6ba51e5ca..b86ddd9ec 100644 --- a/src/main/riddl/test/messages.riddl +++ b/src/main/riddl/test/messages.riddl @@ -21,6 +21,7 @@ command CreateScenario is { } record RunParameters is { + ??? } described as { | TBD }