Skip to content

Commit

Permalink
Add support for updating transitions in state
Browse files Browse the repository at this point in the history
Needed for terraform change
  • Loading branch information
mvantellingen committed Aug 19, 2022
1 parent ee3553f commit 1ceae57
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/repositories/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import { getBaseResourceProperties } from '../helpers'
import { getReferenceFromResourceIdentifier } from './helpers'
import {
ReferenceTypeId,
StateReference,
State,
StateChangeKeyAction,
StateDraft,
StateSetDescriptionAction,
StateSetNameAction,
StateSetRolesAction,
StateSetTransitionsAction,
StateUpdateAction,
} from '@commercetools/platform-sdk'
import { AbstractResourceRepository, RepositoryContext } from './abstract'
Expand Down Expand Up @@ -71,5 +73,17 @@ export class StateRepository extends AbstractResourceRepository {
) => {
resource.roles = roles
},
setTransitions: (
context: RepositoryContext,
resource: Writable<State>,
{ transitions }: StateSetTransitionsAction
) => {
resource.transitions = transitions?.map((resourceId): StateReference => {
return {
id: resourceId.id || "",
typeId: "state",
}
})
}
}
}

0 comments on commit 1ceae57

Please sign in to comment.