Files
marechai/Marechai.Database/Models/SoftwarePlatform.cs
Natalia Portillo d2ab7fc931 feat: Add optional raster logo to software platforms
Platforms (Xbox, PlayStation, PC, etc.) were displayed as plain text/chips
with no visual identity. This adds a single optional logo per platform,
shown as a small icon next to the platform name.

Unlike CompanyLogo (which supports multiple SVG logos per company,
versioned by year, for rebrand history), platforms only need one raster
logo with no history, so this introduces a simpler, separate model:
LogoId (Guid?) and LogoExtension (string?) stored directly on
SoftwarePlatform rather than a new child entity.

Backend:
- SoftwarePlatform gains nullable LogoId/LogoExtension columns
  (migration AddSoftwarePlatformLogo).
- New POST/DELETE /software/platforms/{id}/logo endpoints (Admin only).
  Upload accepts JPEG/PNG/WebP/BMP up to 5MB, validated by extension and
  content type. Reuses the existing ImageMagick-CLI-backed Photos helper
  (same one used for screenshots/photos) to convert the upload into
  JPEG/WebP/AVIF variants under assets/photos/platform-logos/, sized for
  an icon (256px full / 64px thumb) rather than the 4K/512px tiers used
  for photos. Replacing or deleting a logo cleans up all rendered files.
- SoftwarePlatformDto exposes logo_id/logo_extension; GET list/single
  projections include them. Platform cache is invalidated on logo
  upload/delete same as other mutations.
- Photos.EnsureCreated for "platform-logos" registered at startup.

Web UI (legacy Blazor):
- SoftwarePlatformDialog (admin edit dialog) gets an upload/preview/
  remove logo control, calling the new endpoints directly since there's
  only one logo to manage (no separate logo-list page needed).
- Platform chips on the /software landing page and the admin platforms
  grid show a small thumbnail next to the name when a logo is set.

Uno app (Marechai.App):
- AdminSoftwarePlatformsViewModel/Page get the same upload/remove logo
  capability in the edit panel, using FileOpenPicker and the regenerated
  Kiota client. New localized strings (LogoLabel, UploadLogoButton,
  RemoveLogoButton, FailedToUploadLogo, FailedToRemoveLogo) added across
  all 5 languages (en/de/es/fr/pt-BR).

API client:
- openapi.yaml and Marechai.ApiClient regenerated from a running server
  instance to pick up the new endpoints and DTO fields (LogoRequestBuilder,
  extended SoftwarePlatformDto). Diff is purely additive.
2026-06-26 11:18:41 +01:00

16 lines
668 B
C#

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Marechai.Database.Models;
public class SoftwarePlatform : BaseModel<ulong>
{
[Required]
public string Name { get; set; } // Xbox, PlayStation, PC, etc.
public Guid? LogoId { get; set; }
public string LogoExtension { get; set; }
public virtual ICollection<SoftwareRelease> SoftwareReleases { get; set; }
public virtual ICollection<SoftwareScreenshot> Screenshots { get; set; }
public virtual ICollection<SoftwarePlatformsByMachine> Machines { get; set; }
}