@@ -10,7 +10,9 @@ import (
10
10
baseData "github.com/AssetMantle/schema/go/data/base"
11
11
"github.com/AssetMantle/schema/go/documents/base"
12
12
errorConstants "github.com/AssetMantle/schema/go/errors/constants"
13
+ "github.com/AssetMantle/schema/go/ids"
13
14
baseIDs "github.com/AssetMantle/schema/go/ids/base"
15
+ "github.com/AssetMantle/schema/go/lists"
14
16
baseLists "github.com/AssetMantle/schema/go/lists/base"
15
17
baseProperties "github.com/AssetMantle/schema/go/properties/base"
16
18
constantProperties "github.com/AssetMantle/schema/go/properties/constants"
@@ -103,8 +105,11 @@ func (auxiliaryKeeper auxiliaryKeeper) Help(context context.Context, request hel
103
105
return nil , errorConstants .NotAuthorized .Wrapf ("maintainer does not have the permission to mutate maintainers" )
104
106
}
105
107
106
- maintainedProperties := mappable .GetMaintainer (Mappable ).GetMutables ().GetMutablePropertyList ().Add (baseLists .AnyPropertiesToProperties (auxiliaryRequest .MaintainedProperties .Get ()... )... ).Remove (baseLists .AnyPropertiesToProperties (removeMaintainedPropertyList .Get ()... )... )
107
- maintainer := base .NewMaintainer (auxiliaryRequest .ToIdentityID , auxiliaryRequest .MaintainedClassificationID , maintainedProperties .GetPropertyIDList (), internalUtilities .SetModulePermissions (auxiliaryRequest .CanAddMaintainer , auxiliaryRequest .CanMutateMaintainer , auxiliaryRequest .CanRemoveMaintainer ).Add (baseIDs .StringIDsToIDs (auxiliaryRequest .PermissionIDs )... ))
108
+ maintainedProperties := mappable .GetMaintainer (Mappable ).GetMaintainedProperties ().
109
+ Add (idListToListData (auxiliaryRequest .MaintainedProperties .GetPropertyIDList ())... ).
110
+ Remove (idListToListData (removeMaintainedPropertyList .GetPropertyIDList ())... )
111
+
112
+ maintainer := base .NewMaintainer (auxiliaryRequest .ToIdentityID , auxiliaryRequest .MaintainedClassificationID , listDataToIDList (maintainedProperties ), internalUtilities .SetModulePermissions (auxiliaryRequest .CanAddMaintainer , auxiliaryRequest .CanMutateMaintainer , auxiliaryRequest .CanRemoveMaintainer ).Add (baseIDs .StringIDsToIDs (auxiliaryRequest .PermissionIDs )... ))
108
113
109
114
if err := maintainer .ValidateBasic (); err != nil {
110
115
return nil , err
@@ -136,3 +141,23 @@ func (auxiliaryKeeper auxiliaryKeeper) Initialize(mapper helpers.Mapper, paramet
136
141
func keeperPrototype () helpers.AuxiliaryKeeper {
137
142
return auxiliaryKeeper {}
138
143
}
144
+
145
+ func idListToListData (idList lists.IDList ) []data.ListableData {
146
+ listableData := make ([]data.ListableData , len (idList .GetList ()))
147
+
148
+ for i , id := range idList .GetList () {
149
+ listableData [i ] = baseData .NewIDData (id )
150
+ }
151
+
152
+ return listableData
153
+ }
154
+
155
+ func listDataToIDList (listData data.ListData ) lists.IDList {
156
+ idList := make ([]ids.ID , len (listData .Get ()))
157
+
158
+ for i , datum := range listData .Get () {
159
+ idList [i ] = datum .Get ().(data.IDData ).Get ()
160
+ }
161
+
162
+ return baseLists .NewIDList (idList ... )
163
+ }
0 commit comments