Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Webreaper committed Mar 10, 2024
2 parents 844cc75 + 8a74541 commit ff11549
Show file tree
Hide file tree
Showing 249 changed files with 11,441 additions and 254,094 deletions.
Binary file modified .DS_Store
Binary file not shown.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,21 @@ dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion

# Start of NO underscore prefix on private fields
# Define the 'private_fields' symbol group:
dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private

# Define the 'notunderscored' naming style
dotnet_naming_style.notunderscored.capitalization = camel_case
dotnet_naming_style.notunderscored.required_prefix =

# Define the 'private_fields_notunderscored' naming rule
dotnet_naming_rule.private_fields_notunderscored.symbols = private_fields
dotnet_naming_rule.private_fields_notunderscored.style = notunderscored
dotnet_naming_rule.private_fields_notunderscored.severity = error
# End of No underscore prefix on private fields

# ReSharper properties
resharper_autodetect_indent_settings = true
resharper_csharp_extra_spaces = leave_all
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Setup Dotnet Environment
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.100'
dotnet-version: '8.0.100'

- name: Install WASM-Tools
run: dotnet workload install wasm-tools
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/damselfly-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
- name: Setup Dotnet Environment
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.100'
dotnet-version: '8.0.100'

- name: Install WASM-Tools
run: dotnet workload install wasm-tools
Expand Down
8 changes: 0 additions & 8 deletions Damselfly.Core.Constants/AzureDetectionType.cs

This file was deleted.

7 changes: 2 additions & 5 deletions Damselfly.Core.Constants/ConfigSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ public class ConfigSettings
public const string DisableObjectDetector = "DisableObjectDetector";
public const string LogLevel = "LogLevel";

public const string AzureEndpoint = "AzureEndpoint";
public const string AzureApiKey = "AzureApiKey";
public const string AzureUseFreeTier = "UseFreeTier";
public const string AzureDetectionType = "AzureDetectionType";

public const string AltCPULimitEnabled = "AltCPULimitEnabled";
public const string CPULimit = "CPULimit";
public const string AltCPULimit = "AltCPULimit";
Expand All @@ -43,6 +38,8 @@ public class ConfigSettings
public const string ForceLogin = "ForceLogin";
public const string AllowExternalRegistration = "AllowExternalRegistration";
public const string UseSmtp = "UseSMTP";
public const string EnableImageEditing = "EnableImageEditing";
public const string EnableBackgroundThumbs = "EnableBackgroundThumbs";

public const string SmtpServer = "SmtpServer";
public const string SmtpPort = "SmtpPort";
Expand Down
1 change: 0 additions & 1 deletion Damselfly.Core.Constants/Damselfly.Core.Constants.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
6 changes: 6 additions & 0 deletions Damselfly.Core.Constants/DamselflyContants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Damselfly.Core.Constants;

public static class DamselflyContants
{
public const int PageSize = 250;
}
6 changes: 4 additions & 2 deletions Damselfly.Core.Constants/SearchTypes.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
namespace Damselfly.Core.Constants;

namespace Damselfly.Core.Constants;

public enum SortOrderType
{
Expand Down Expand Up @@ -27,4 +28,5 @@ public enum OrientationType
Portrait,
Panorama,
Square
}
}

4 changes: 2 additions & 2 deletions Damselfly.Core.DbModels/AuthorisationRegistration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public static void SetupPolicies(this AuthorizationOptions config, IServiceColle
var configService = serviceProvider.GetService<IConfigService>();
var userManager = serviceProvider.GetService<UserManager<AppIdentityUser>>();
var logger = serviceProvider.GetService<ILogger<AuthorizationOptions>>();
var enablePolicies = configService.GetBool(ConfigSettings.EnablePoliciesAndRoles,
ConfigSettings.DefaultEnableRolesAndAuth);
var enablePolicies = configService!.GetBool(ConfigSettings.EnablePoliciesAndRoles,
ConfigSettings.DefaultEnableRolesAndAuth);


if ( enablePolicies )
Expand Down
96 changes: 50 additions & 46 deletions Damselfly.Core.DbModels/Damselfly.Core.DbModels.csproj
Original file line number Diff line number Diff line change
@@ -1,46 +1,50 @@
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="7.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.9">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.9">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="7.0.9" />
<PackageReference Include="FluentValidation" Version="11.6.0" />
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="7.0.9" />
</ItemGroup>

<ItemGroup>
<Folder Include="Authentication\" />
<Folder Include="Interfaces\" />
<Folder Include="Utils\" />
<Folder Include="Models\" />
<Folder Include="Models\SideCars\" />
<Folder Include="Images\" />
<Folder Include="Models\API Models\" />
<Folder Include="Models\ConfigSettings\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Damselfly.Core.Utils\Damselfly.Core.Utils.csproj" />
<ProjectReference Include="..\Damselfly.Core.Interfaces\Damselfly.Core.Interfaces.csproj" />
<ProjectReference Include="..\Damselfly.Shared.Utils\Damselfly.Shared.Utils.csproj" />
</ItemGroup>
<ItemGroup>
<None Remove="Microsoft.AspNetCore.Identity.EntityFrameworkCore" />
<None Remove="Models\" />
<None Remove="Models\SideCars\" />
<None Remove="FluentValidation" />
<None Remove="Images\" />
<None Remove="Microsoft.AspNetCore.Authorization" />
<None Remove="Models\API Models\" />
<None Remove="Models\ConfigSettings\" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging.Console" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" />
<PackageReference Include="FluentValidation" />
<PackageReference Include="Microsoft.AspNetCore.Authorization" />
</ItemGroup>

<ItemGroup>
<Folder Include="Authentication\" />
<Folder Include="Utils\" />
<Folder Include="Models\" />
<Folder Include="Models\SideCars\" />
<Folder Include="Images\" />
<Folder Include="Models\ConfigSettings\" />
<Folder Include="Models\TransformationModels\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Damselfly.Core.Utils\Damselfly.Core.Utils.csproj" />
<ProjectReference Include="..\Damselfly.Core.Interfaces\Damselfly.Core.Interfaces.csproj" />
<ProjectReference Include="..\Damselfly.Shared.Utils\Damselfly.Shared.Utils.csproj" />
</ItemGroup>
<ItemGroup>
<None Remove="Microsoft.AspNetCore.Identity.EntityFrameworkCore" />
<None Remove="Models\" />
<None Remove="Models\SideCars\" />
<None Remove="FluentValidation" />
<None Remove="Images\" />
<None Remove="Microsoft.AspNetCore.Authorization" />
<None Remove="Models\API Models\" />
<None Remove="Models\ConfigSettings\" />
<None Remove="Models\TransformationModels\" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Damselfly.Core.DbModels/Interfaces/IConfigService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Damselfly.Core.ScopedServices.Interfaces;
public interface IConfigService
{
void Set(string name, string value);
string Get(string name, string defaultIfNotExists = null);
string Get(string name, string? defaultIfNotExists = null);
EnumType Get<EnumType>(string name, EnumType defaultIfNotExists = default) where EnumType : struct;
bool GetBool(string name, bool defaultIfNotExists = default);
int GetInt(string name, int defaultIfNotExists = default);
Expand Down
7 changes: 5 additions & 2 deletions Damselfly.Core.DbModels/Interfaces/IPeopleService.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Damselfly.Core.DbModels.Models.API_Models;
using Damselfly.Core.DbModels.Models.APIModels;
using Damselfly.Core.Models;

namespace Damselfly.Core.ScopedServices.Interfaces;
Expand All @@ -9,6 +11,7 @@ public interface IPeopleService
Task<Person> GetPerson(int personId);
Task<List<Person>> GetAllPeople();
Task<List<string>> GetPeopleNames(string searchText);
Task UpdatePerson(Person thePerson, string newName);
Task UpdateName(ImageObject theObject, string newName);
Task UpdatePersonName(NameChangeRequest req);
Task<bool> NeedsAIMigration();
Task ExecuteAIMigration( AIMigrationRequest req );
}
9 changes: 9 additions & 0 deletions Damselfly.Core.DbModels/Interfaces/ISearchHint.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System;

namespace Damselfly.Core.ScopedServices.Interfaces;

public interface ISearchHint
{
Action Clear { get; set; }
string Description { get; set; }
}
4 changes: 3 additions & 1 deletion Damselfly.Core.DbModels/Interfaces/ISearchService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public interface ISearchService
OrientationType? Orientation { get; set; }

string SearchBreadcrumbs { get; }
IEnumerable<ISearchHint> SearchHints { get; }

void SetDateRange(DateTime? min, DateTime? max);

void Refresh();
Expand All @@ -42,5 +44,5 @@ public interface ISearchService
event Action OnSearchQueryChanged;
event Action<SearchResponse> OnSearchResultsChanged;

Task LoadMore(int count = 250);
Task LoadMore(int count = DamselflyContants.PageSize);
}
2 changes: 1 addition & 1 deletion Damselfly.Core.DbModels/Interfaces/ITagService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public interface ITagService
Task<ICollection<Tag>> GetFavouriteTags();
Task<bool> ToggleFavourite(Tag tag);

Task UpdateTagsAsync(ICollection<int> imageIds, ICollection<string> tagsToAdd, ICollection<string> tagsToDelete,
Task UpdateTagsAsync(ICollection<int> imageIds, ICollection<string>? tagsToAdd, ICollection<string>? tagsToDelete,
int? userId = null);

Task SetExifFieldAsync(ICollection<int> imageIds, ExifOperation.ExifType exifType, string newValue,
Expand Down
2 changes: 1 addition & 1 deletion Damselfly.Core.DbModels/Interfaces/IUserFolderService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public interface IUserFolderService
{
event Action OnFoldersChanged;
Task<List<Folder>> GetFilteredFolders(string filterTerm);
Task<Folder> GetFolder(int folderId);
Task<Folder?> GetFolder(int folderId);
void ToggleExpand(Folder item);
bool IsExpanded(Folder item);
}
6 changes: 3 additions & 3 deletions Damselfly.Core.DbModels/Interfaces/IUserManagementService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ public interface IUserMgmtService
bool AllowPublicRegistration { get; } // WASM: Do we need this?
Task<ICollection<AppIdentityUser>> GetUsers();
Task<AppIdentityUser> GetUser( int userId );
Task<UserResponse> UpdateUserAsync(AppIdentityUser user, ICollection<string> newRoles);
Task<UserResponse> SetUserPasswordAsync(AppIdentityUser user, string password);
Task<UserResponse> CreateNewUser(AppIdentityUser newUser, string password, ICollection<string> roles = null);
Task<UserResponse> UpdateUserAsync(string userName, string email, ICollection<string> newRoles);
Task<UserResponse> SetUserPasswordAsync(string userName, string password);
Task<UserResponse> CreateNewUser(string userName, string email, string password, ICollection<string>? roles = null);
Task<ICollection<ApplicationRole>> GetRoles();
Task AddUserToDefaultRoles(AppIdentityUser user);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Damselfly.Core.DbModels.Models.API_Models;

public class AIMigrationRequest
{
public bool MigrateAllImages { get; set; }
public bool MigrateImagesWithFaces { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
public class ConfigSetRequest
{
public string Name { get; set; }
public string NewValue { get; set; }
public string? NewValue { get; set; }
public int? UserId { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System;
namespace Damselfly.Core.DbModels.Models.APIModels;


public class NameChangeRequest
{
public int ObjectId { get; set; }
public int? PersonId { get; set; }
public int? ImageObjectId { get; set; }
public string NewName { get; set; }
public bool Merge { get; set; }
}

7 changes: 4 additions & 3 deletions Damselfly.Core.DbModels/Models/API Models/NewUserRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ namespace Damselfly.Core.DbModels.Models.APIModels;

public class UserRequest
{
public AppIdentityUser User { get; set; }
public string Password { get; set; }
public ICollection<string> Roles { get; set; }
public string? UserName { get; set; }
public string? Email { get; set; }
public string? Password { get; set; }
public ICollection<string>? Roles { get; set; }
}

public class UserResponse
Expand Down
2 changes: 1 addition & 1 deletion Damselfly.Core.DbModels/Models/API Models/RescanRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ public class RescanRequest
{
public RescanTypes ScanType { get; set; }
public int? FolderId { get; set; }
public ICollection<int> ImageIds { get; set; }
public ICollection<int>? ImageIds { get; set; }
public bool RescanAll { get; set; } = false;
}
10 changes: 10 additions & 0 deletions Damselfly.Core.DbModels/Models/API Models/SearchHint.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System;
using Damselfly.Core.ScopedServices.Interfaces;

namespace Damselfly.Core.DbModels.Models.API_Models;

public class SearchHint : ISearchHint
{
public Action Clear { get; set; }
public string Description { get; set; }
}
1 change: 0 additions & 1 deletion Damselfly.Core.DbModels/Models/API Models/Statistics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ public class Statistics
public int PendingKeywordOps { get; set; }
public int PendingKeywordImages { get; set; }
public long TotalImagesSizeBytes { get; set; }
public string AzureMonthlyTransactions { get; set; }
public int ObjectsRecognised { get; set; }
public int PeopleFound { get; set; }
public int PeopleIdentified { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions Damselfly.Core.DbModels/Models/API Models/TagUpdateRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Damselfly.Core.DbModels.Models.APIModels;
public class TagUpdateRequest
{
public ICollection<int> ImageIDs { get; set; }
public ICollection<string> TagsToAdd { get; set; }
public ICollection<string> TagsToDelete { get; set; }
public ICollection<string>? TagsToAdd { get; set; }
public ICollection<string>? TagsToDelete { get; set; }
public int? UserId { get; set; }
}
4 changes: 2 additions & 2 deletions Damselfly.Core.DbModels/Models/ConfigSetting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ namespace Damselfly.Core.Models;
public class ConfigSetting
{
public int ConfigSettingId { get; set; }
public string Name { get; set; }
public string Value { get; set; }
public required string Name { get; set; }
public string? Value { get; set; }

public int? UserId { get; set; }
public virtual AppIdentityUser User { get; set; }
Expand Down
Loading

0 comments on commit ff11549

Please sign in to comment.