feat(11-04): add UpdateProfileAsync to ProfileService and ImportLogoFromBytesAsync to BrandingService
- ProfileService.UpdateProfileAsync: replaces profile by name and persists the change - IBrandingService: add ImportLogoFromBytesAsync to interface contract - BrandingService.ImportLogoFromBytesAsync: validates magic bytes, compresses if > 512KB, returns LogoData - BrandingService.ImportLogoAsync: refactored to delegate to ImportLogoFromBytesAsync - ProfileServiceTests: 2 new tests (UpdateProfileAsync happy path + KeyNotFoundException) - BrandingServiceTests: 2 new tests (ImportLogoFromBytesAsync valid PNG + invalid bytes) - Tests.csproj: suppress NU1701 for pre-existing LiveCharts2/OpenTK transitive warnings
This commit is contained in:
@@ -51,4 +51,13 @@ public class ProfileService
|
||||
profiles.Remove(target);
|
||||
await _repository.SaveAsync(profiles);
|
||||
}
|
||||
|
||||
public async Task UpdateProfileAsync(TenantProfile profile)
|
||||
{
|
||||
var profiles = (await _repository.LoadAsync()).ToList();
|
||||
var idx = profiles.FindIndex(p => p.Name == profile.Name);
|
||||
if (idx < 0) throw new KeyNotFoundException($"Profile '{profile.Name}' not found.");
|
||||
profiles[idx] = profile;
|
||||
await _repository.SaveAsync(profiles);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user