Skip to content

Commit

Permalink
Correct RIDDL input to resolve remaining issues per riddlc 0.39
Browse files Browse the repository at this point in the history
  • Loading branch information
reid-spencer committed Mar 9, 2024
1 parent 3e8ced2 commit b6d2438
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 35 deletions.
6 changes: 5 additions & 1 deletion src/main/riddl/ImprovingApp.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ 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
show-warnings = true
show-missing-warnings = false
show-style-warnings = false
show-usage-warnings = false
debug = false
group-by-message-kind = true
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/riddl/Members/members.riddl
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ context MemberContext is {
}
}
on command EditMemberInfo {
set field DraftMemberState.info to "MemberContext.EditableInfo"
set field DraftMemberState.meta to "MemberContext.MetaInfo"
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
Expand Down
4 changes: 2 additions & 2 deletions src/main/riddl/Product/product.riddl
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ context ProductContext is {
on command ProductContext.InactivateProduct {
set field DefinedProductState.meta to "ProductContext.ProductMetaInfo"
send event ProductInactivated to outlet ProductEvents.Events
become entity ProductContext.Product to handler ProductContext.Product.InactiveProductState.InactiveProductHandler
become entity ProductContext.Product to handler Product.DefinedProductState.InactiveProductHandler
}
on query GetProductInfo{
"yield ProductInfoResult message"
Expand All @@ -168,7 +168,7 @@ context ProductContext is {
on command ProductContext.ActivateProduct{
set field DefinedProductState.meta to "ProductContext.ProductMetaInfo"
send event ProductActivated to outlet ProductEvents.Events
become entity ProductContext.Product to handler ProductContext.Product.ActiveProductHandler
become entity ProductContext.Product to handler Product.DefinedProductState.ActiveProductHandler
}
on command ProductContext.InactivateProduct{
error "Product is already Inactive"
Expand Down
60 changes: 30 additions & 30 deletions src/main/riddl/Store/Store.riddl
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,19 @@ context StoreContext is {
on command CreateStore {
send event StoreCreated
to outlet StoreEvents.Events
morph entity StoreContext.Store to state StoreContext.Store.DraftStore with record DraftStoreState
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 {
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"
Expand All @@ -104,17 +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 StoreContext.Store to state DeletedStore with record DeletedStoreState
morph entity StoreContext.Store to state DeletedStore with record DeletedStoreData
}
on command MakeStoreReady {
"yield the StoreIsReady event"
morph entity StoreContext.Store to state CreatedStore with record CreatedStoreState
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"
Expand All @@ -131,12 +131,12 @@ context StoreContext is {
}
}

record CreatedStoreState is {
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"
Expand All @@ -153,15 +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"
set field Store.CreatedStore.meta to "StoreContext.MetaInfo"
send event StoreOpened to outlet StoreEvents.Events
become entity StoreContext.Store to handler StoreContext.Store.CreatedStoreState.OpenStoreHandler
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"
set field CreatedStore.meta to "StoreContext.MetaInfo"
send event StoreClosed to outlet StoreEvents.Events
become entity StoreContext.Store to handler StoreContext.Store.CreatedStoreState.ClosedStoreHandler
become entity StoreContext.Store to handler StoreContext.Store.CreatedStore.ClosedStoreHandler
}
on command AddProductsToStore {
"add provided products to store definition"
Expand All @@ -176,8 +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"
morph entity StoreContext.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)
}
}
Expand All @@ -202,9 +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"
set field CreatedStore.meta to "StoreContext.MetaInfo"
send event StoreClosed to outlet StoreEvents.Events
become entity StoreContext.Store to handler StoreContext.ClosedStoreHandler
become entity StoreContext.Store to handler StoreContext.Store.CreatedStore.ClosedStoreHandler
}
on command AddProductsToStore {
"add provided products to store definition"
Expand All @@ -219,8 +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"
morph entity StoreContext.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)
}
}
Expand All @@ -238,14 +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"
set field CreatedStore.meta to "StoreContext.MetaInfo"
send event StoreDeleted to outlet StoreEvents.Events
morph entity StoreContext.Store to state DeletedStore with record DeletedStoreState
morph entity StoreContext.Store to state DeletedStore with record DeletedStoreData
}
on command OpenStore {
set field CreatedStoreState.meta to "StoreContext.MetaInfo"
set field CreatedStore.meta to "StoreContext.MetaInfo"
send event StoreOpened to outlet StoreEvents.Events
become entity StoreContext.Store to handler StoreContext.Store.CreatedStoreState.OpenStoreHandler
become entity StoreContext.Store to handler Store.CreatedStore.OpenStoreHandler
}
on command CloseStore {
error "Store is already closed."
Expand All @@ -263,26 +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"
morph entity StoreContext.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: 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"
morph entity StoreContext.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 {
Expand All @@ -291,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"
Expand Down

0 comments on commit b6d2438

Please sign in to comment.