Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
8801b88
fix database inheritance
Behnam-Emamian Nov 29, 2025
341162f
add radzen
Behnam-Emamian Nov 29, 2025
41991d8
abstract class ModuleService
Behnam-Emamian Nov 30, 2025
5849071
Enhance category management with tree view and context menu #5
mirza-developer Nov 30, 2025
79eeca6
fix merge conflicts #5
mirza-developer Nov 30, 2025
a079b3c
add radzen tree for categories #5
mirza-developer Nov 30, 2025
23dc877
Integrate Radzen components and improve category tree #5
mirza-developer Dec 2, 2025
0da65db
fix conflict
Behnam-Emamian Dec 3, 2025
b6af827
File Entity
Behnam-Emamian Dec 7, 2025
848355f
merge main changes
Behnam-Emamian Dec 18, 2025
0644985
Add File management CRUD API and client service
mirza-developer Dec 18, 2025
8fafbb9
Enhance file edit UI, add metadata & category selection #18
mirza-developer Dec 19, 2025
dc7b0c0
Merge branch 'main' of https://github.com/ICTAce/FileHub into feature…
mirza-developer Dec 19, 2025
61dd919
Update FileCategory FKs and fix ImageName column mapping
mirza-developer Dec 22, 2025
90a9498
Add file upload support to file edit form and backend #18
mirza-developer Dec 22, 2025
cb64fe8
Switch to RadzenUpload for file uploads with progress #18
mirza-developer Dec 22, 2025
2111b48
Refactor file/image upload to use Blazor InputFile
mirza-developer Dec 24, 2025
47b6533
Add support for multi-category file associations
mirza-developer Dec 26, 2025
33c5f53
Add ModuleId to FileCategory entity and schema #18
mirza-developer Dec 26, 2025
f44978a
update nugets
Behnam-Emamian Dec 28, 2025
3c4fa74
Refactor file listing to use Radzen cards and controls for a more att…
mirza-developer Dec 28, 2025
d0c5787
Merge branch 'feature/filehub' of https://github.com/ICTAce/FileHub i…
mirza-developer Dec 28, 2025
477b065
Refactor file form and card UI for clarity and usability #18
mirza-developer Dec 29, 2025
266c2bf
Add file download endpoint and UI; improve file serving #18
mirza-developer Dec 31, 2025
6a48124
Update file download handling and UI counter feedback #18
mirza-developer Dec 31, 2025
9f35c3a
Add download param & atomic download counter increment #18
mirza-developer Dec 31, 2025
4e73cab
Refactor file deletion to Edit page, remove from Index #18
mirza-developer Jan 1, 2026
0b4e4f2
Remove SampleModule feature and all related code #18
mirza-developer Jan 2, 2026
7bda640
Add FileHub module manager with install, export, search #18
mirza-developer Jan 3, 2026
a96abb7
delete log
Behnam-Emamian Jan 4, 2026
6390b60
add fallback to ApplicationQueryContext
Behnam-Emamian Jan 4, 2026
0780530
remove sample module
Behnam-Emamian Jan 4, 2026
8a71e2e
remove last samplemodule
Behnam-Emamian Jan 4, 2026
5bc25fd
server content is local files
Behnam-Emamian Jan 4, 2026
9000bc0
merge from main
Behnam-Emamian Jan 4, 2026
aaeb401
add RadzenThemeManager
Behnam-Emamian Jan 4, 2026
06a2a7c
Improve file/image upload UX and update file save logic #18
mirza-developer Jan 5, 2026
b05f885
Add mock IFileService and FileHub client-side test suites #18
mirza-developer Jan 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ msbuild.binlog
.vscode/
*.binlog
*.nupkg
/Server/Content/Log
/Server/Content
/Server/Data
/TestResults/
8 changes: 4 additions & 4 deletions Client.Tests/BaseTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ private void RegisterServices()
TestContext.Services.AddLogging();

TestContext.Services.AddScoped<ILogService, MockLogService>();
TestContext.Services.AddScoped<ISampleModuleService, MockSampleModuleService>();
TestContext.Services.AddScoped<ICategoryService, MockCategoryService>();
TestContext.Services.AddScoped<Services.IFileService, MockFileService>();
TestContext.Services.AddScoped<IUserService, MockUserService>();
TestContext.Services.AddScoped<ISettingService, MockSettingService>();
TestContext.Services.AddScoped<IModuleService, MockModuleService>();
Expand Down Expand Up @@ -156,16 +156,16 @@ protected Module CreateModuleState(int moduleId = 1, int pageId = 1, string titl
PageId = pageId,
Title = title,
SiteId = 1,
ModuleDefinitionName = "ICTAce.FileHub.SampleModule",
ModuleDefinitionName = "ICTAce.FileHub",
AllPages = false,
IsDeleted = false,
Pane = "Content",
Order = 1,
ContainerType = string.Empty,
ModuleDefinition = new ModuleDefinition
{
ModuleDefinitionName = "ICTAce.FileHub.SampleModule",
Name = "Sample Module",
ModuleDefinitionName = "ICTAce.FileHub",
Name = "FileHub",
Version = "1.0.0",
ServerManagerType = string.Empty,
ControlTypeTemplate = string.Empty,
Expand Down
172 changes: 172 additions & 0 deletions Client.Tests/Mocks/MockFileService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
// Licensed to ICTAce under the MIT license.

namespace ICTAce.FileHub.Client.Tests.Mocks;

public class MockFileService : Services.IFileService
{
private readonly List<GetFileDto> _files = [];
private int _nextId = 1;

public MockFileService()
{
_files.Add(new GetFileDto
{
Id = 1,
ModuleId = 1,
Name = "Test File 1",
FileName = "test-file-1.pdf",
ImageName = "test-image-1.png",
Description = "Test file description 1",
FileSize = "1.5 MB",
Downloads = 10,
CategoryIds = [1],
CreatedBy = "Test User",
CreatedOn = DateTime.Now.AddDays(-10),
ModifiedBy = "Test User",
ModifiedOn = DateTime.Now.AddDays(-5)
});

_files.Add(new GetFileDto
{
Id = 2,
ModuleId = 1,
Name = "Test File 2",
FileName = "test-file-2.docx",
ImageName = "test-image-2.jpg",
Description = "Test file description 2",
FileSize = "2.3 MB",
Downloads = 25,
CategoryIds = [1, 2],
CreatedBy = "Test User",
CreatedOn = DateTime.Now.AddDays(-8),
ModifiedBy = "Test User",
ModifiedOn = DateTime.Now.AddDays(-3)
});

_nextId = 3;
}

public Task<GetFileDto> GetAsync(int id, int moduleId)
{
var file = _files.FirstOrDefault(f => f.Id == id && f.ModuleId == moduleId);
if (file == null)
{
throw new InvalidOperationException($"File with Id {id} and ModuleId {moduleId} not found");
}
return Task.FromResult(file);
}

public Task<PagedResult<ListFileDto>> ListAsync(int moduleId, int pageNumber = 1, int pageSize = 10)
{
var items = _files
.Where(f => f.ModuleId == moduleId)
.Skip((pageNumber - 1) * pageSize)
.Take(pageSize)
.Select(f => new ListFileDto
{
Id = f.Id,
Name = f.Name,
FileName = f.FileName,
ImageName = f.ImageName,
Description = f.Description,
FileSize = f.FileSize,
Downloads = f.Downloads,
CreatedOn = f.CreatedOn
})
.ToList();

var totalCount = _files.Count(f => f.ModuleId == moduleId);

var pagedResult = new PagedResult<ListFileDto>
{
Items = items,
TotalCount = totalCount,
PageNumber = pageNumber,
PageSize = pageSize
};

return Task.FromResult(pagedResult);
}

public Task<int> CreateAsync(int moduleId, CreateAndUpdateFileDto dto)
{
var newFile = new GetFileDto
{
Id = _nextId++,
ModuleId = moduleId,
Name = dto.Name,
FileName = dto.FileName,
ImageName = dto.ImageName,
Description = dto.Description,
FileSize = dto.FileSize,
Downloads = dto.Downloads,
CategoryIds = dto.CategoryIds ?? [],
CreatedBy = "Test User",
CreatedOn = DateTime.Now,
ModifiedBy = "Test User",
ModifiedOn = DateTime.Now
};

_files.Add(newFile);
return Task.FromResult(newFile.Id);
}

public Task<int> UpdateAsync(int id, int moduleId, CreateAndUpdateFileDto dto)
{
var file = _files.FirstOrDefault(f => f.Id == id && f.ModuleId == moduleId);
if (file == null)
{
throw new InvalidOperationException($"File with Id {id} and ModuleId {moduleId} not found");
}

file.Name = dto.Name;
file.FileName = dto.FileName;
file.ImageName = dto.ImageName;
file.Description = dto.Description;
file.FileSize = dto.FileSize;
file.Downloads = dto.Downloads;
file.CategoryIds = dto.CategoryIds ?? [];
file.ModifiedBy = "Test User";
file.ModifiedOn = DateTime.Now;

return Task.FromResult(file.Id);
}

public Task DeleteAsync(int id, int moduleId)
{
var file = _files.FirstOrDefault(f => f.Id == id && f.ModuleId == moduleId);
if (file != null)
{
_files.Remove(file);
}
return Task.CompletedTask;
}

public Task<string> UploadFileAsync(int moduleId, Stream fileStream, string fileName)
{
// Simulate file upload by generating a unique filename
var uniqueFileName = $"{Guid.NewGuid()}_{fileName}";
return Task.FromResult(uniqueFileName);
}

public void ClearData()
{
_files.Clear();
_nextId = 1;
}

public void AddTestData(GetFileDto file)
{
_files.Add(file);
}

public int GetFileCount()
{
return _files.Count;
}

public List<GetFileDto> GetAllFiles()
{
return _files;
}
}
130 changes: 0 additions & 130 deletions Client.Tests/Mocks/MockMyModuleService.cs

This file was deleted.

10 changes: 5 additions & 5 deletions Client.Tests/Mocks/MockOqtaneServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ public Task<List<ModuleDefinition>> GetModuleDefinitionsAsync(int siteId)
{
new ModuleDefinition
{
ModuleDefinitionName = "ICTAce.FileHub.SampleModule",
Name = "Sample Module",
ModuleDefinitionName = "ICTAce.FileHub",
Name = "FileHub",
Version = "1.0.0"
}
});
Expand All @@ -113,8 +113,8 @@ public Task<ModuleDefinition> GetModuleDefinitionAsync(int moduleDefinitionId, i
return Task.FromResult(new ModuleDefinition
{
ModuleDefinitionId = moduleDefinitionId,
ModuleDefinitionName = "ICTAce.FileHub.SampleModule",
Name = "Sample Module",
ModuleDefinitionName = "ICTAce.FileHub",
Name = "FileHub",
Version = "1.0.0"
});
}
Expand All @@ -124,7 +124,7 @@ public Task<ModuleDefinition> GetModuleDefinitionAsync(string moduleDefinitionNa
return Task.FromResult(new ModuleDefinition
{
ModuleDefinitionName = moduleDefinitionName,
Name = "Sample Module",
Name = "FileHub",
Version = "1.0.0"
});
}
Expand Down
Loading
Loading