Do conversion inside collections.Add

This commit is contained in:
Abhishek Pandey 2023-11-30 18:37:08 -08:00
parent 05dee79560
commit c932df0252
2 changed files with 7 additions and 6 deletions

View File

@ -10,6 +10,7 @@ import (
"time"
"github.com/alcionai/clues"
"github.com/microsoftgraph/msgraph-sdk-go/models"
"github.com/spatialcurrent/go-lazy/pkg/lazy"
"github.com/alcionai/corso/src/internal/common/idname"
@ -193,11 +194,11 @@ func newColl(
// Adds an itemID to the collection. This will make it eligible to be
// populated. The return values denotes if the item was previously
// present or is new one.
func (oc *Collection) Add(cdi CorsoDriveItemable) bool {
func (oc *Collection) Add(item models.DriveItemable) bool {
// _, found := oc.driveItems[ptr.Val(item.GetId())]
// oc.driveItems[ptr.Val(item.GetId())] = item
//cdi := ToCorsoDriveItemable(item)
cdi := ToCorsoDriveItemable(item)
_, found := oc.driveItems[ptr.Val(cdi.GetId())]
oc.driveItems[ptr.Val(cdi.GetId())] = cdi

View File

@ -696,7 +696,7 @@ func (c *Collections) handleDelete(
func (c *Collections) getCollectionPath(
driveID string,
item CorsoDriveItemable,
item models.DriveItemable,
) (path.Path, error) {
var (
pb = odConsts.DriveFolderPrefixBuilder(driveID)
@ -845,7 +845,7 @@ func (c *Collections) PopulateDriveCollections(
func (c *Collections) processItem(
ctx context.Context,
di models.DriveItemable,
item models.DriveItemable,
driveID, driveName string,
oldPrevPaths, currPrevPaths, newPrevPaths map[string]string,
seenFolders map[string]string,
@ -855,7 +855,7 @@ func (c *Collections) processItem(
counter *count.Bus,
skipper fault.AddSkipper,
) error {
item := ToCorsoDriveItemable(di)
// item := ToCorsoDriveItemable(di)
var (
itemID = ptr.Val(item.GetId())
@ -870,7 +870,7 @@ func (c *Collections) processItem(
"item_is_folder", isFolder)
if item.GetMalware() != nil {
addtl := graph.ItemInfo(di)
addtl := graph.ItemInfo(item)
skip := fault.FileSkip(fault.SkipMalware, driveID, itemID, itemName, addtl)
if isFolder {