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:
Dev
2026-04-02 15:23:04 +02:00
parent d09db015f2
commit b52f60f8eb
10 changed files with 123 additions and 0 deletions

View 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();
}

View 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; }
}

View 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
);

View 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
);

View 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; }
}

View 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();
}

View 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
);

View 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);
}

View 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);
}

View 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);
}