From 06d4f764e77be405d23400609ca0cc69a84e9d63 Mon Sep 17 00:00:00 2001 From: Abhishek Pandey Date: Fri, 18 Aug 2023 19:26:31 +0530 Subject: [PATCH] Add sharepoint fields --- src/internal/m365/collection/drive/collection.go | 11 ++++++++++- src/internal/m365/collection/drive/collections.go | 13 ++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/internal/m365/collection/drive/collection.go b/src/internal/m365/collection/drive/collection.go index a9c71240a..5a4927c3c 100644 --- a/src/internal/m365/collection/drive/collection.go +++ b/src/internal/m365/collection/drive/collection.go @@ -108,6 +108,7 @@ type CorsoDriveItemable interface { GetLastModifiedDateTime() *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time GetMalware() models.Malwareable GetSharepointIds() models.SharepointIdsable + GetOdataType() *string } type CorsoDriveItem struct { @@ -122,6 +123,8 @@ type CorsoDriveItem struct { CreatedDateTime *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time LastModifiedDateTime *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time Malware models.Malwareable + SharepointIds models.SharepointIdsable + OdataType *string } func (c *CorsoDriveItem) GetId() *string { @@ -177,7 +180,11 @@ func (c *CorsoDriveItem) GetMalware() models.Malwareable { } func (c *CorsoDriveItem) GetSharepointIds() models.SharepointIdsable { - return nil + return c.SharepointIds +} + +func (c *CorsoDriveItem) GetOdataType() *string { + return c.OdataType } // models.DriveItemable to CorsoDriveItemable @@ -194,6 +201,8 @@ func ToCorsoDriveItemable(item models.DriveItemable) CorsoDriveItemable { LastModifiedDateTime: item.GetLastModifiedDateTime(), Malware: item.GetMalware(), AdditionalData: item.GetAdditionalData(), + SharepointIds: item.GetSharepointIds(), + OdataType: item.GetOdataType(), } } diff --git a/src/internal/m365/collection/drive/collections.go b/src/internal/m365/collection/drive/collections.go index 2723a90c8..9df725442 100644 --- a/src/internal/m365/collection/drive/collections.go +++ b/src/internal/m365/collection/drive/collections.go @@ -674,7 +674,14 @@ func getBackingStoreSize(ctx context.Context, item models.DriveItemable) { driveItem := item.(*models.DriveItem) // Get backing store st := driveItem.GetBackingStore().(*store.InMemoryBackingStore) - logger.Ctx(ctx).Infow("serialized size", "in_mem_store_size", sizePkg.Of(st.Store)) + logger.Ctx(ctx).Infow("store size", "in_mem_store_size", sizePkg.Of(st.Store)) + logger.Ctx(ctx).Infow("drive item size", "in_mem_store_size", sizePkg.Of(driveItem)) +} + +func getBackingStoreSize1(ctx context.Context, item CorsoDriveItemable) { + driveItem := item.(*CorsoDriveItem) + // Get backing store + logger.Ctx(ctx).Infow("corso serialized size", "in_mem_store_size", sizePkg.Of(driveItem)) } // UpdateCollections initializes and adds the provided drive items to Collections @@ -821,6 +828,8 @@ func (c *Collections) UpdateCollections( if col.Add(item) { getBackingStoreSize(ictx, item) c.NumItems++ + cdi := ToCorsoDriveItemable(item) + getBackingStoreSize1(ictx, cdi) } case item.GetFile() != nil: @@ -860,6 +869,8 @@ func (c *Collections) UpdateCollections( getBackingStoreSize(ictx, item) c.NumItems++ c.NumFiles++ + cdi := ToCorsoDriveItemable(item) + getBackingStoreSize1(ictx, cdi) } // Do this after adding the file to the collection so if we fail to add