Skip to content

Commit

Permalink
applicatioon & organization fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexWeinstein92 committed Mar 8, 2024
1 parent 0d987b0 commit f5f058a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/main/riddl/Applications/application.riddl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ application UserInterface is {
command PurchaseProduct is {
productSku: ProductContext.SKU
}
type ProductPurchased is {
event ProductPurchased is {
productSku: ProductContext.SKU,
productInfo: ProductContext.ProductInfo,
productMeta: ProductContext.ProductMetaInfo
Expand All @@ -83,7 +83,7 @@ application UserInterface is {
on command ImprovingApp.GatewayAPI.DemoScenarioGateway.PurchaseProduct from user ImprovingApp.GatewayAPI.Member {
tell command ImprovingApp.UserInterface.PurchaseProduct to context ProductContext
}
on event UserInterface.ProductPurchased from context ProductContext {
on event ImprovingApp.UserInterface.ProductPurchased from context ProductContext {
//tell result ProductContext.ProductCreated to projector ProductContext.ProductViews
}
}
Expand All @@ -106,7 +106,7 @@ application CommandLine is {
on command ImprovingApp.CommandLine.StartScenario from user ImprovingApp.GatewayAPI.Member {
tell command CommandLine.StartScenario to context GatewayAction
}
on event ImprovingApp.CommandLine.ScenarioStarted from context GatewayAction {
on result ImprovingApp.CommandLine.ScenarioStarted from context GatewayAction {
"display in terminal"
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/riddl/ImprovingApp.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ common = {
dry-run = false
hide-warnings = true
debug = false
group-by-messages-kind = true
group-by-message-kind = true
}

# This block provides options for the "hugo" command to translate riddl to a hugo web site.
Expand Down
14 changes: 8 additions & 6 deletions src/main/riddl/Organization/organization.riddl
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,11 @@ context OrganizationContext is {
on command ImprovingApp.OrganizationContext.SuspendOrganization {
set field EstablishedOrganizationState.orgMeta to "OrganizationContext.MetaInfo"
send event OrganizationSuspended to outlet OrganizationEvents.Events
become entity Organization to handler SuspendedOrganizationHandler
become entity ImprovingApp.OrganizationContext.Organization to handler SuspendedOrganizationHandler
}
on command ImprovingApp.OrganizationContext.TerminateOrganization {
set field EstablishedOrganizationState.orgMeta to "OrganizationContext.MetaInfo"
morph entity Organization to state TerminatedOrganization
morph entity ImprovingApp.OrganizationContext.Organization to state ImprovingApp.OrganizationContext.Organization.TerminatedOrganization
with record TerminatedOrganizationState
//(lastMeta = @EstablishedOrganizationState.orgMeta)
}
Expand Down Expand Up @@ -395,23 +395,25 @@ context OrganizationContext is {
}
}
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"
send event OrganizationActivated
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"
send event OrganizationSuspended to outlet OrganizationEvents.Events
become entity Organization to handler SuspendedOrganizationHandler
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"
morph entity Organization to state TerminatedOrganization with record TerminatedOrganizationState
morph entity ImprovingApp.OrganizationContext.Organization to
state ImprovingApp.OrganizationContext.Organization.TerminatedOrganization with record TerminatedOrganizationState
}
on query GetOrganizationInfo {
reply result OrganizationInfo
Expand Down

0 comments on commit f5f058a

Please sign in to comment.