Skip to content

Commit 0e29c94

Browse files
authored
Merge pull request #89 from linuxfoundation/feat/map-sfdc-funding
feat(projects): sync SFDC funding__c to v2 funding attribute
1 parent 8037227 commit 0e29c94

4 files changed

Lines changed: 15 additions & 1 deletion

File tree

cmd/lfx-v1-sync-helper/client_projects.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ func updateProject(ctx context.Context, basePayload *projectservice.UpdateProjec
9393
ParentUID: stringToStringPtr(basePayload.ParentUID),
9494
Stage: basePayload.Stage,
9595
Category: basePayload.Category,
96+
Funding: basePayload.Funding,
9697
FundingModel: basePayload.FundingModel,
9798
CharterURL: basePayload.CharterURL,
9899
LegalEntityType: basePayload.LegalEntityType,
@@ -213,6 +214,7 @@ func projectBasesEqual(a, b *projectservice.ProjectBase) bool {
213214
stringPtrToString(a.ParentUID) == stringPtrToString(b.ParentUID) &&
214215
stringPtrToString(a.Stage) == stringPtrToString(b.Stage) &&
215216
stringPtrToString(a.Category) == stringPtrToString(b.Category) &&
217+
stringPtrToString(a.Funding) == stringPtrToString(b.Funding) &&
216218
stringSliceEqual(a.FundingModel, b.FundingModel) &&
217219
stringPtrToString(a.CharterURL) == stringPtrToString(b.CharterURL) &&
218220
stringPtrToString(a.LegalEntityType) == stringPtrToString(b.LegalEntityType) &&

cmd/lfx-v1-sync-helper/handlers_projects.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,11 @@ func mapV1DataToProjectCreatePayload(ctx context.Context, v1Data map[string]any)
302302
payload.LegalEntityType = &category
303303
}
304304

305+
// Map funding status.
306+
if funding, ok := v1Data["funding__c"].(string); ok && funding != "" {
307+
payload.Funding = &funding
308+
}
309+
305310
// Map funding model (split semicolon-delimited values).
306311
if model, ok := v1Data["model__c"].(string); ok && model != "" {
307312
models := strings.Split(model, ";")
@@ -478,6 +483,11 @@ func mapV1DataToProjectUpdateBasePayload(ctx context.Context, projectUID string,
478483
payload.LegalEntityType = &category
479484
}
480485

486+
// Map funding status.
487+
if funding, ok := v1Data["funding__c"].(string); ok && funding != "" {
488+
payload.Funding = &funding
489+
}
490+
481491
// Map funding model (split semicolon-delimited values).
482492
if model, ok := v1Data["model__c"].(string); ok && model != "" {
483493
models := strings.Split(model, ";")

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ require (
1717
github.com/golang-jwt/jwt/v5 v5.3.1
1818
github.com/google/uuid v1.6.0
1919
github.com/linuxfoundation/lfx-v2-committee-service v0.2.22
20-
github.com/linuxfoundation/lfx-v2-project-service v0.6.3
20+
github.com/linuxfoundation/lfx-v2-project-service v0.6.4
2121
github.com/nats-io/nats.go v1.48.0
2222
github.com/opensearch-project/opensearch-go/v4 v4.5.0
2323
github.com/patrickmn/go-cache v2.1.0+incompatible

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ github.com/linuxfoundation/lfx-v2-project-service v0.6.1 h1:Cv2a0qGFYriC3Rwjo3cX
8282
github.com/linuxfoundation/lfx-v2-project-service v0.6.1/go.mod h1:pwUWh2KKmV8Ji+wCSrlidvZC7VOn0gVCfSFv7Cyoe5o=
8383
github.com/linuxfoundation/lfx-v2-project-service v0.6.3 h1:FUTmSvhtbbIyIEIu4nszi3C7Gs5OyLCaxs9jNCyWY9E=
8484
github.com/linuxfoundation/lfx-v2-project-service v0.6.3/go.mod h1:3ULEcvKwHWcBcMxSW3yeMPGqk5+tnu2X+FjcaAw9Fy4=
85+
github.com/linuxfoundation/lfx-v2-project-service v0.6.4 h1:Odv+Ls1EjomnyAdSG3NSZGJ+wibyJCqCPY6xdIDljG8=
86+
github.com/linuxfoundation/lfx-v2-project-service v0.6.4/go.mod h1:3ULEcvKwHWcBcMxSW3yeMPGqk5+tnu2X+FjcaAw9Fy4=
8587
github.com/nats-io/nats.go v1.48.0 h1:pSFyXApG+yWU/TgbKCjmm5K4wrHu86231/w84qRVR+U=
8688
github.com/nats-io/nats.go v1.48.0/go.mod h1:iRWIPokVIFbVijxuMQq4y9ttaBTMe0SFdlZfMDd+33g=
8789
github.com/nats-io/nkeys v0.4.15 h1:JACV5jRVO9V856KOapQ7x+EY8Jo3qw1vJt/9Jpwzkk4=

0 commit comments

Comments
 (0)