feat(03-01): create 7 core models and 3 service interfaces for Phase 3
- StorageNode, StorageScanOptions models - SearchResult, SearchOptions models - DuplicateItem, DuplicateGroup, DuplicateScanOptions models - IStorageService, ISearchService, IDuplicatesService interfaces
This commit is contained in:
8
SharepointToolbox/Core/Models/DuplicateGroup.cs
Normal file
8
SharepointToolbox/Core/Models/DuplicateGroup.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
namespace SharepointToolbox.Core.Models;
|
||||||
|
|
||||||
|
public class DuplicateGroup
|
||||||
|
{
|
||||||
|
public string GroupKey { get; set; } = string.Empty;
|
||||||
|
public string Name { get; set; } = string.Empty;
|
||||||
|
public List<DuplicateItem> Items { get; set; } = new();
|
||||||
|
}
|
||||||
13
SharepointToolbox/Core/Models/DuplicateItem.cs
Normal file
13
SharepointToolbox/Core/Models/DuplicateItem.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
namespace SharepointToolbox.Core.Models;
|
||||||
|
|
||||||
|
public class DuplicateItem
|
||||||
|
{
|
||||||
|
public string Name { get; set; } = string.Empty;
|
||||||
|
public string Path { get; set; } = string.Empty;
|
||||||
|
public string Library { get; set; } = string.Empty;
|
||||||
|
public long? SizeBytes { get; set; }
|
||||||
|
public DateTime? Created { get; set; }
|
||||||
|
public DateTime? Modified { get; set; }
|
||||||
|
public int? FolderCount { get; set; }
|
||||||
|
public int? FileCount { get; set; }
|
||||||
|
}
|
||||||
12
SharepointToolbox/Core/Models/DuplicateScanOptions.cs
Normal file
12
SharepointToolbox/Core/Models/DuplicateScanOptions.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
namespace SharepointToolbox.Core.Models;
|
||||||
|
|
||||||
|
public record DuplicateScanOptions(
|
||||||
|
string Mode = "Files", // "Files" or "Folders"
|
||||||
|
bool MatchSize = true,
|
||||||
|
bool MatchCreated = false,
|
||||||
|
bool MatchModified = false,
|
||||||
|
bool MatchSubfolderCount = false,
|
||||||
|
bool MatchFileCount = false,
|
||||||
|
bool IncludeSubsites = false,
|
||||||
|
string? Library = null
|
||||||
|
);
|
||||||
15
SharepointToolbox/Core/Models/SearchOptions.cs
Normal file
15
SharepointToolbox/Core/Models/SearchOptions.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
namespace SharepointToolbox.Core.Models;
|
||||||
|
|
||||||
|
public record SearchOptions(
|
||||||
|
string[] Extensions,
|
||||||
|
string? Regex,
|
||||||
|
DateTime? CreatedAfter,
|
||||||
|
DateTime? CreatedBefore,
|
||||||
|
DateTime? ModifiedAfter,
|
||||||
|
DateTime? ModifiedBefore,
|
||||||
|
string? CreatedBy,
|
||||||
|
string? ModifiedBy,
|
||||||
|
string? Library,
|
||||||
|
int MaxResults,
|
||||||
|
string SiteUrl
|
||||||
|
);
|
||||||
13
SharepointToolbox/Core/Models/SearchResult.cs
Normal file
13
SharepointToolbox/Core/Models/SearchResult.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
namespace SharepointToolbox.Core.Models;
|
||||||
|
|
||||||
|
public class SearchResult
|
||||||
|
{
|
||||||
|
public string Title { get; set; } = string.Empty;
|
||||||
|
public string Path { get; set; } = string.Empty;
|
||||||
|
public string FileExtension { get; set; } = string.Empty;
|
||||||
|
public DateTime? Created { get; set; }
|
||||||
|
public DateTime? LastModified { get; set; }
|
||||||
|
public string Author { get; set; } = string.Empty;
|
||||||
|
public string ModifiedBy { get; set; } = string.Empty;
|
||||||
|
public long SizeBytes { get; set; }
|
||||||
|
}
|
||||||
16
SharepointToolbox/Core/Models/StorageNode.cs
Normal file
16
SharepointToolbox/Core/Models/StorageNode.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
namespace SharepointToolbox.Core.Models;
|
||||||
|
|
||||||
|
public class StorageNode
|
||||||
|
{
|
||||||
|
public string Name { get; set; } = string.Empty;
|
||||||
|
public string Url { get; set; } = string.Empty;
|
||||||
|
public string SiteTitle { get; set; } = string.Empty;
|
||||||
|
public string Library { get; set; } = string.Empty;
|
||||||
|
public long TotalSizeBytes { get; set; }
|
||||||
|
public long FileStreamSizeBytes { get; set; }
|
||||||
|
public long VersionSizeBytes => Math.Max(0L, TotalSizeBytes - FileStreamSizeBytes);
|
||||||
|
public long TotalFileCount { get; set; }
|
||||||
|
public DateTime? LastModified { get; set; }
|
||||||
|
public int IndentLevel { get; set; }
|
||||||
|
public List<StorageNode> Children { get; set; } = new();
|
||||||
|
}
|
||||||
7
SharepointToolbox/Core/Models/StorageScanOptions.cs
Normal file
7
SharepointToolbox/Core/Models/StorageScanOptions.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
namespace SharepointToolbox.Core.Models;
|
||||||
|
|
||||||
|
public record StorageScanOptions(
|
||||||
|
bool PerLibrary = true,
|
||||||
|
bool IncludeSubsites = false,
|
||||||
|
int FolderDepth = 0 // 0 = library root only; >0 = recurse N levels
|
||||||
|
);
|
||||||
13
SharepointToolbox/Services/IDuplicatesService.cs
Normal file
13
SharepointToolbox/Services/IDuplicatesService.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using Microsoft.SharePoint.Client;
|
||||||
|
using SharepointToolbox.Core.Models;
|
||||||
|
|
||||||
|
namespace SharepointToolbox.Services;
|
||||||
|
|
||||||
|
public interface IDuplicatesService
|
||||||
|
{
|
||||||
|
Task<IReadOnlyList<DuplicateGroup>> ScanDuplicatesAsync(
|
||||||
|
ClientContext ctx,
|
||||||
|
DuplicateScanOptions options,
|
||||||
|
IProgress<OperationProgress> progress,
|
||||||
|
CancellationToken ct);
|
||||||
|
}
|
||||||
13
SharepointToolbox/Services/ISearchService.cs
Normal file
13
SharepointToolbox/Services/ISearchService.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using Microsoft.SharePoint.Client;
|
||||||
|
using SharepointToolbox.Core.Models;
|
||||||
|
|
||||||
|
namespace SharepointToolbox.Services;
|
||||||
|
|
||||||
|
public interface ISearchService
|
||||||
|
{
|
||||||
|
Task<IReadOnlyList<SearchResult>> SearchFilesAsync(
|
||||||
|
ClientContext ctx,
|
||||||
|
SearchOptions options,
|
||||||
|
IProgress<OperationProgress> progress,
|
||||||
|
CancellationToken ct);
|
||||||
|
}
|
||||||
13
SharepointToolbox/Services/IStorageService.cs
Normal file
13
SharepointToolbox/Services/IStorageService.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using Microsoft.SharePoint.Client;
|
||||||
|
using SharepointToolbox.Core.Models;
|
||||||
|
|
||||||
|
namespace SharepointToolbox.Services;
|
||||||
|
|
||||||
|
public interface IStorageService
|
||||||
|
{
|
||||||
|
Task<IReadOnlyList<StorageNode>> CollectStorageAsync(
|
||||||
|
ClientContext ctx,
|
||||||
|
StorageScanOptions options,
|
||||||
|
IProgress<OperationProgress> progress,
|
||||||
|
CancellationToken ct);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user