@@ -7,6 +7,7 @@ package main
77import (
88 "context"
99 "fmt"
10+ "strings"
1011
1112 committeeservice "github.com/linuxfoundation/lfx-v2-committee-service/gen/committee_service"
1213 "github.com/nats-io/nats.go/jetstream"
@@ -26,13 +27,14 @@ var allowedCommitteeCategories = map[string]bool{
2627 "Marketing Committee/Sub Committee" : true ,
2728 "Marketing Mailing List" : true ,
2829 "Marketing Oversight Committee/Marketing Advisory Committee" : true ,
29- "Other" : true ,
30- "Product Security" : true ,
31- "Special Interest Group" : true ,
32- "Technical Mailing List" : true ,
33- "Technical Oversight Committee/Technical Advisory Committee" : true ,
34- "Technical Steering Committee" : true ,
35- "Working Group" : true ,
30+ "Other" : true ,
31+ "Product Security" : true ,
32+ "Special Interest Group" : true ,
33+ "Technical Advisory Committee" : true ,
34+ "Technical Mailing List" : true ,
35+ "Technical Oversight Committee" : true ,
36+ "Technical Steering Committee" : true ,
37+ "Working Group" : true ,
3638}
3739
3840// allowedAppointedByValues defines the valid values for appointed_by__c mapping to appointed_by.
@@ -101,11 +103,25 @@ func mapAppointedByToValidValue(ctx context.Context, appointedBy string) string
101103}
102104
103105// mapTypeToCategory filters and maps type__c to category.
104- func mapTypeToCategory (ctx context.Context , typeVal string ) * string {
106+ func mapTypeToCategory (ctx context.Context , typeVal , committeeName string ) * string {
105107 if typeVal == "" {
106108 return nil
107109 }
108110
111+ if typeVal == "Technical Oversight Committee/Technical Advisory Committee" {
112+ // Special case mapping.
113+ if strings .Contains (strings .ToLower (committeeName ), "advisory" ) {
114+ mapped := "Technical Advisory Committee"
115+ return & mapped
116+ }
117+ if strings .Contains (strings .ToLower (committeeName ), "tac" ) {
118+ mapped := "Technical Advisory Committee"
119+ return & mapped
120+ }
121+ mapped := "Technical Oversight Committee"
122+ return & mapped
123+ }
124+
109125 if allowedCommitteeCategories [typeVal ] {
110126 return & typeVal
111127 }
@@ -233,7 +249,7 @@ func mapV1DataToCommitteeCreatePayload(ctx context.Context, v1Data map[string]an
233249 }
234250
235251 if typeVal , ok := v1Data ["type__c" ].(string ); ok && typeVal != "" {
236- if category := mapTypeToCategory (ctx , typeVal ); category != nil {
252+ if category := mapTypeToCategory (ctx , typeVal , name ); category != nil {
237253 payload .Category = * category // Map Type to Category with validation.
238254 }
239255 }
@@ -308,7 +324,7 @@ func mapV1DataToCommitteeUpdateBasePayload(ctx context.Context, committeeUID str
308324 }
309325
310326 if typeVal , ok := v1Data ["type__c" ].(string ); ok && typeVal != "" {
311- if category := mapTypeToCategory (ctx , typeVal ); category != nil {
327+ if category := mapTypeToCategory (ctx , typeVal , name ); category != nil {
312328 payload .Category = * category // Map Type to Category with validation.
313329 }
314330 }
0 commit comments