diff options
Diffstat (limited to 'code')
| -rw-r--r-- | code/api/Database/Models/User.cs | 3 | ||||
| -rw-r--r-- | code/api/I2R.Storage.Api.csproj | 1 | ||||
| -rw-r--r-- | code/api/Models/FileSystemEntry.cs | 9 | ||||
| -rw-r--r-- | code/api/Services/Admin/UserService.cs | 1 | ||||
| -rw-r--r-- | code/api/Services/System/StorageService.cs | 23 |
5 files changed, 33 insertions, 4 deletions
diff --git a/code/api/Database/Models/User.cs b/code/api/Database/Models/User.cs index 7f7b0e9..bd2d4ec 100644 --- a/code/api/Database/Models/User.cs +++ b/code/api/Database/Models/User.cs @@ -1,5 +1,3 @@ -using System.Security.Claims; - namespace I2R.Storage.Api.Database.Models; public class User : Base @@ -14,7 +12,6 @@ public class User : Base public string LastName { get; set; } public DateTime? LastLoggedOn { get; set; } - public IEnumerable<Claim> DefaultClaims() => new List<Claim>() { new(AppClaims.USER_ID, Id.ToString()), new(AppClaims.USERNAME, Username), diff --git a/code/api/I2R.Storage.Api.csproj b/code/api/I2R.Storage.Api.csproj index b601c37..4dc596f 100644 --- a/code/api/I2R.Storage.Api.csproj +++ b/code/api/I2R.Storage.Api.csproj @@ -15,6 +15,7 @@ <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> </PackageReference> + <PackageReference Include="MR.AspNetCore.Pagination" Version="2.0.0" /> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.1" /> </ItemGroup> diff --git a/code/api/Models/FileSystemEntry.cs b/code/api/Models/FileSystemEntry.cs new file mode 100644 index 0000000..432f87c --- /dev/null +++ b/code/api/Models/FileSystemEntry.cs @@ -0,0 +1,9 @@ +namespace I2R.Storage.Api.Models; + +public class FileSystemEntry +{ + public Guid Id { get; set; } + public string Name { get; set; } + public string ContentType { get; set; } + public long SizeInBytes { get; set; } +}
\ No newline at end of file diff --git a/code/api/Services/Admin/UserService.cs b/code/api/Services/Admin/UserService.cs index faa67c0..f149d73 100644 --- a/code/api/Services/Admin/UserService.cs +++ b/code/api/Services/Admin/UserService.cs @@ -1,4 +1,3 @@ -using System.Security.Claims; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.Cookies; diff --git a/code/api/Services/System/StorageService.cs b/code/api/Services/System/StorageService.cs new file mode 100644 index 0000000..adbb883 --- /dev/null +++ b/code/api/Services/System/StorageService.cs @@ -0,0 +1,23 @@ +using MR.AspNetCore.Pagination; +using MR.EntityFrameworkCore.KeysetPagination; + +namespace I2R.Storage.Api.Services.System; + +public class StorageService +{ + private readonly AppDatabase _database; + private readonly ILogger<StorageService> _logger; + + public StorageService(AppDatabase database, ILogger<StorageService> logger) { + _database = database; + _logger = logger; + } + + public async Task<KeysetPaginationResult<FileSystemEntry>> GetFileSystemEntriesAsync(Guid parent = default) { + var keysetQuery = _database.Folders + .Include(c => c.Files) + .ConditionalWhere(() => parent != default, folder => folder.ParentId == parent) + .Select(p => new FileSystemEntry() { }); + return default; + } +}
\ No newline at end of file |
