Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
add teams chats selectors boilerplate (#5075)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanfkeepers authored Jan 25, 2024
1 parent 433e93f commit e90fef4
Show file tree
Hide file tree
Showing 8 changed files with 1,385 additions and 15 deletions.
File renamed without changes.
20 changes: 10 additions & 10 deletions src/pkg/path/service_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ const (
)

var strToSvc = map[string]ServiceType{
ExchangeService.String(): ExchangeService,
ExchangeMetadataService.String(): ExchangeMetadataService,
OneDriveService.String(): OneDriveService,
OneDriveMetadataService.String(): OneDriveMetadataService,
SharePointService.String(): SharePointService,
SharePointMetadataService.String(): SharePointMetadataService,
GroupsService.String(): GroupsService,
GroupsMetadataService.String(): GroupsMetadataService,
TeamsChatsService.String(): TeamsChatsService,
TeamsChatsMetadataService.String(): TeamsChatsMetadataService,
strings.ToLower(ExchangeService.String()): ExchangeService,
strings.ToLower(ExchangeMetadataService.String()): ExchangeMetadataService,
strings.ToLower(OneDriveService.String()): OneDriveService,
strings.ToLower(OneDriveMetadataService.String()): OneDriveMetadataService,
strings.ToLower(SharePointService.String()): SharePointService,
strings.ToLower(SharePointMetadataService.String()): SharePointMetadataService,
strings.ToLower(GroupsService.String()): GroupsService,
strings.ToLower(GroupsMetadataService.String()): GroupsMetadataService,
strings.ToLower(TeamsChatsService.String()): TeamsChatsService,
strings.ToLower(TeamsChatsMetadataService.String()): TeamsChatsMetadataService,
}

func ToServiceType(service string) ServiceType {
Expand Down
8 changes: 4 additions & 4 deletions src/pkg/selectors/exchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ func (ec exchangeCategory) isLeaf() bool {
// pathValues transforms the two paths to maps of identified properties.
//
// Example:
// [tenantID, service, userPN, category, mailFolder, mailID]
// [tenantID, service, userID, category, mailFolder, mailID]
// => {exchMailFolder: mailFolder, exchMail: mailID}
func (ec exchangeCategory) pathValues(
repo path.Path,
Expand Down Expand Up @@ -772,7 +772,7 @@ func (s ExchangeScope) matchesInfo(dii details.ItemInfo) bool {

infoCat := s.InfoCategory()

cfpc := categoryFromItemType(info.ItemType)
cfpc := exchangeCategoryFromItemType(info.ItemType)
if !typeAndCategoryMatches(infoCat, cfpc) {
return false
}
Expand Down Expand Up @@ -801,10 +801,10 @@ func (s ExchangeScope) matchesInfo(dii details.ItemInfo) bool {
return s.Matches(infoCat, i)
}

// categoryFromItemType interprets the category represented by the ExchangeInfo
// exchangeCategoryFromItemType interprets the category represented by the ExchangeInfo
// struct. Since every ExchangeInfo can hold all exchange data info, the exact
// type that the struct represents must be compared using its ItemType prop.
func categoryFromItemType(pct details.ItemType) exchangeCategory {
func exchangeCategoryFromItemType(pct details.ItemType) exchangeCategory {
switch pct {
case details.ExchangeContact:
return ExchangeContact
Expand Down
2 changes: 1 addition & 1 deletion src/pkg/selectors/exchange_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1602,7 +1602,7 @@ func (suite *ExchangeSelectorSuite) TestCategoryFromItemType() {
suite.Run(test.name, func() {
t := suite.T()

result := categoryFromItemType(test.input)
result := exchangeCategoryFromItemType(test.input)
assert.Equal(t, test.expect, result)
})
}
Expand Down
2 changes: 2 additions & 0 deletions src/pkg/selectors/selectors.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const (
ServiceOneDrive service = 2 // OneDrive
ServiceSharePoint service = 3 // SharePoint
ServiceGroups service = 4 // Groups
ServiceTeamsChats service = 5 // TeamsChats
)

var serviceToPathType = map[service]path.ServiceType{
Expand All @@ -34,6 +35,7 @@ var serviceToPathType = map[service]path.ServiceType{
ServiceOneDrive: path.OneDriveService,
ServiceSharePoint: path.SharePointService,
ServiceGroups: path.GroupsService,
ServiceTeamsChats: path.TeamsChatsService,
}

var (
Expand Down
Loading

0 comments on commit e90fef4

Please sign in to comment.