File tree Expand file tree Collapse file tree 4 files changed +57
-0
lines changed
Expand file tree Collapse file tree 4 files changed +57
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @labdigital/commercetools-mock " : patch
3+ ---
4+
5+ Added missing mutations for custom fields on associate roles, product selections and business units
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import type {
55 AssociateRoleDraft ,
66 AssociateRoleRemovePermissionAction ,
77 AssociateRoleSetCustomFieldAction ,
8+ AssociateRoleSetCustomTypeAction ,
89 AssociateRoleSetNameAction ,
910 AssociateRoleSetPermissionsAction ,
1011 AssociateRoleUpdateAction ,
@@ -107,6 +108,22 @@ class AssociateRoleUpdateHandler
107108 }
108109 }
109110
111+ setCustomType (
112+ context : RepositoryContext ,
113+ resource : Writable < AssociateRole > ,
114+ { type, fields } : AssociateRoleSetCustomTypeAction ,
115+ ) {
116+ if ( type ) {
117+ resource . custom = createCustomFields (
118+ { type, fields } ,
119+ context . projectKey ,
120+ this . _storage ,
121+ ) ;
122+ } else {
123+ resource . custom = undefined ;
124+ }
125+ }
126+
110127 setName (
111128 context : RepositoryContext ,
112129 resource : Writable < AssociateRole > ,
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import type {
22 BusinessUnitChangeApprovalRuleModeAction ,
33 BusinessUnitChangeAssociateModeAction ,
44 BusinessUnitChangeStatusAction ,
5+ BusinessUnitSetCustomTypeAction ,
56 BusinessUnitUpdateAction ,
67 CompanyDraft ,
78 DivisionDraft ,
@@ -260,6 +261,22 @@ class BusinessUnitUpdateHandler
260261 resource . contactEmail = contactEmail ;
261262 }
262263
264+ setCustomType (
265+ context : RepositoryContext ,
266+ resource : Writable < BusinessUnit > ,
267+ { type, fields } : BusinessUnitSetCustomTypeAction ,
268+ ) {
269+ if ( type ) {
270+ resource . custom = createCustomFields (
271+ { type, fields } ,
272+ context . projectKey ,
273+ this . _storage ,
274+ ) ;
275+ } else {
276+ resource . custom = undefined ;
277+ }
278+ }
279+
263280 setStoreMode (
264281 context : RepositoryContext ,
265282 resource : Writable < BusinessUnit > ,
Original file line number Diff line number Diff line change @@ -2,8 +2,10 @@ import type {
22 ProductSelection ,
33 ProductSelectionChangeNameAction ,
44 ProductSelectionDraft ,
5+ ProductSelectionSetCustomTypeAction ,
56 ProductSelectionUpdateAction ,
67} from "@commercetools/platform-sdk" ;
8+ import { createCustomFields } from "~src/repositories/helpers" ;
79import { getBaseResourceProperties } from "../helpers" ;
810import type { AbstractStorage } from "../storage/abstract" ;
911import type { Writable } from "../types" ;
@@ -45,4 +47,20 @@ class ProductSelectionUpdateHandler
4547 ) {
4648 resource . name = name ;
4749 }
50+
51+ setCustomType (
52+ context : RepositoryContext ,
53+ resource : Writable < ProductSelection > ,
54+ { type, fields } : ProductSelectionSetCustomTypeAction ,
55+ ) {
56+ if ( type ) {
57+ resource . custom = createCustomFields (
58+ { type, fields } ,
59+ context . projectKey ,
60+ this . _storage ,
61+ ) ;
62+ } else {
63+ resource . custom = undefined ;
64+ }
65+ }
4866}
You can’t perform that action at this time.
0 commit comments